Subject | Re: RES: [firebird-support] Should i use UTF8 for all character fields in my database? |
---|---|
Author | Fabiano |
Post date | 2012-09-19T13:28:17Z |
Hi!
I tried that (actually inserted 50.000 records each table), and here follows the test results:
recreate table test_utf8 (
column1 varchar(100) character set UTF8 collate unicode_ci_ai);
recreate table test_iso8859_1 (
column1 varchar(100) character set ISO8859_1 collate pt_br);
-- 1m5s146
set term !! ;
execute block
as
declare variable i integer;
begin
i = 0;
while (i < 50000) do
begin
insert into test_utf8 values (uuid_to_char(gen_uuid()));
i = i + 1;
end
insert into test_utf8 values ('xxx');
end !!
set term ; !!
-- 1m4s959
set term !! ;
execute block
as
declare variable i integer;
begin
i = 0;
while (i < 50000) do
begin
insert into test_iso8859_1 values (uuid_to_char(gen_uuid()));
i = i + 1;
end
insert into test_iso8859_1 values ('xxx');
end !!
set term ; !!
-- 0s468
select * from test_utf8 where column1 = 'xxx';
-- 0s561
select * from test_iso8859_1 where column1 = 'xxx';
-- 1s716, 1s653, 1s841
select first 1 * from test_utf8 order by column1;
-- 0s671, 0s717, 0s748
select first 1 * from test_iso8859_1 order by column1;
So, the main performance difference here was ordering the data (2X-3X slower). Other operations seems to have the same performance (althought i didnĀ“t use special characters in the records).
Regards,
Fabiano
I tried that (actually inserted 50.000 records each table), and here follows the test results:
recreate table test_utf8 (
column1 varchar(100) character set UTF8 collate unicode_ci_ai);
recreate table test_iso8859_1 (
column1 varchar(100) character set ISO8859_1 collate pt_br);
-- 1m5s146
set term !! ;
execute block
as
declare variable i integer;
begin
i = 0;
while (i < 50000) do
begin
insert into test_utf8 values (uuid_to_char(gen_uuid()));
i = i + 1;
end
insert into test_utf8 values ('xxx');
end !!
set term ; !!
-- 1m4s959
set term !! ;
execute block
as
declare variable i integer;
begin
i = 0;
while (i < 50000) do
begin
insert into test_iso8859_1 values (uuid_to_char(gen_uuid()));
i = i + 1;
end
insert into test_iso8859_1 values ('xxx');
end !!
set term ; !!
-- 0s468
select * from test_utf8 where column1 = 'xxx';
-- 0s561
select * from test_iso8859_1 where column1 = 'xxx';
-- 1s716, 1s653, 1s841
select first 1 * from test_utf8 order by column1;
-- 0s671, 0s717, 0s748
select first 1 * from test_iso8859_1 order by column1;
So, the main performance difference here was ordering the data (2X-3X slower). Other operations seems to have the same performance (althought i didnĀ“t use special characters in the records).
Regards,
Fabiano
--- In firebird-support@yahoogroups.com, "Fabiano" <fabianoaspro@...> wrote:
>
> Firebird is extreme slow with UTF-8 character set.
>
> Try it:
> Create the same table with/without UTF-8 encoding, put 5000 records with no
> indexes then do:
>
> 'select * from table order by fieldA
>
> select * from table where FieldA='xxxx'
>
>
>
> Cheers
>
>
>
>
>
> [Non-text portions of this message have been removed]
>