Slow query from blob in NONE but not in UTF8
--------------------------------------------

                 Key: CORE-5729
                 URL: http://tracker.firebirdsql.org/browse/CORE-5729
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 2.5.8, 3.0.2
         Environment: WINDOWS 10 32 bits, WINDOWS 10 64 bits.
            Reporter: Fabrice V
         Attachments: Sample database.7z

Slow query from blob SUB_TYPE 1 with charset NONE but not in charset UTF8 !

CREATE TABLE CUSTOMER
(
C_ID VARCHAR(20) NOT NULL,
C_FIRSTNAME VARCHAR(50),
C_LASTNAME VARCHAR(50),
PRIMARY KEY (C_ID)
);


/* This table is used by end user to add custom fields */
CREATE TABLE USERFIELD
(
U_ID VARCHAR(20) NOT NULL,
U_VALUE  BLOB SUB_TYPE 1,
U_CUSTOMERCODE VARCHAR(20),
PRIMARY KEY (U_ID)
);

CREATE TABLE INVOICE
(
I_ID VARCHAR(20) NOT NULL,
I_NUMBER VARCHAR(50),
I_AMOUNT FLOAT,
PRIMARY KEY (I_ID)
);


Query :
select first C_FIRSTNAME,
(select I_NUMBER from INVOICE  where I_ID =(select first 1  QUF.LV_VALEUR 
 from USERFIELD QUF where  QUF.U_CUSTOMERCODE=q1.C_ID )) as U_USERFIELD1
from CUSTOMER Q1 


With 1 record in INVOICE/CUSTOMER  and  200 000 records in table USERFIELD


Result with UTF8 database :
=======================
Statement executed (elapsed time: 0.000s).
21 fetches, 0 marks, 0 reads, 0 writes.
0 inserts, 0 updates, 0 deletes, 0 index, 4 seq.
Delta memory: 0 bytes.
Total execution time: 0.031s
Script execution finished.

Result with NONE database :
=======================
Statement executed (elapsed time: 0.000s).
334240 fetches, 0 marks, 4009 reads, 0 writes.
0 inserts, 0 updates, 0 deletes, 0 index, 234825 seq.
Delta memory: 0 bytes.
Total execution time: 0.375s
Script execution finished.

Both result on same computer with local databases.

So why NONE is 10 time slower than UTF8 ?
In NONE have some very slow responsive time with some records in USERFIELD, to 
fix is I have added cast( varchar(20)) like this :
select first C_FIRSTNAME,
(select I_NUMBER from INVOICE  where I_ID =(select first 1 cast(SUBSTRING(  
QUF.LV_VALEUR  from 1 for 20) as varchar(20)) 
 from USERFIELD QUF where  QUF.U_CUSTOMERCODE=q1.C_ID )) as U_USERFIELD1
from CUSTOMER Q1 


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to