Subject | Verry slow querry on FB 2 |
---|---|
Author | Paul Mercea |
Post date | 2006-02-19T19:01:01Z |
Hi
I have a production db on FB 1.5.3 SS Windows XP, works verry well and a
test db on FB 2.0 beta 2 SS on a Suse 9.2 (without NTPL).
On FB2 database are same structure, index, etc,etc and I have imported data
from FB 1.5.3
I have notice a verry bi difference running same query :
select * from sys_products where barcode not in
(select barcode from sys_barcode
group by barcode having count(barcode)>1
PLAN (SYS_BARCODE ORDER SYS_BARCODE_BARCODE))PLAN (SYS_PRODUCTS NATURAL)
On FB 1.5.3 query runs in 2.5 sec and on FB 2 in 210 seconds.
I have analyze those results and I see this difference.
Analysis for FB1.5.3
Query Time
------------------------------------------------
Prepare : 16
Execute : 62
Avg fetch time: 2.58 ms
Memory
------------------------------------------------
Current: 1,051,640
Max : 1,182,124
Buffers: 2,048
Operations
------------------------------------------------
Read : 0
Writes : 4
Fetches: 3,490
Plan:
------------------------------------------------
PLAN (SYS_BARCODE ORDER SYS_BARCODE_BARCODE)
PLAN (SYS_PRODUCTS NATURAL)
Enchanced Info:
+--------------------------+-------+-----------+---------+---------+--------
--+
| Table Name | Index | Non-Index | Updated | Deleted |
Inserted |
| | reads | reads | | |
|
+--------------------------+-------+-----------+---------+---------+--------
--+
| RDB$FIELDS| 13 | 0 | 0 | 0 |
0 |
| RDB$INDEX_SEGMENTS| 1 | 0 | 0 | 0 |
0 |
| RDB$INDICES| 1 | 0 | 0 | 0 |
0 |
| RDB$RELATION_FIELDS| 13 | 0 | 0 | 0 |
0 |
| RDB$RELATIONS| 3 | 0 | 0 | 0 |
0 |
| RDB$RELATION_CONSTRAINTS| 1 | 0 | 0 | 0 |
0 |
| SYS_BARCODE| 454 | 0 | 0 | 0 |
0 |
| SYS_PRODUCTS| 0 | 397 | 0 | 0 |
0 |
+--------------------------+-------+-----------+---------+---------+--------
--+
Analysis for FB2
Query Time
------------------------------------------------
Prepare : 32
Execute : 210,812
Avg fetch time: 210,812.00 ms
Memory
------------------------------------------------
Current: 855,376
Max : 890,348
Buffers: 2,048
Operations
------------------------------------------------
Read : 0
Writes : 76
Fetches: 2.270033E7
Plan:
------------------------------------------------
PLAN (SYS_BARCODE ORDER SYS_BARCODE_BARCODE)
PLAN (SYS_PRODUCTS NATURAL)
Enchanced Info:
+--------------------------+-------+-----------+---------+---------+--------
--+
| Table Name | Index | Non-Index | Updated | Deleted |
Inserted |
| | reads | reads | | |
|
+--------------------------+-------+-----------+---------+---------+--------
--+
| RDB$FIELDS| 13 | 0 | 0 | 0 |
0 |
| RDB$INDEX_SEGMENTS| 1 | 0 | 0 | 0 |
0 |
| RDB$INDICES| 1 | 0 | 0 | 0 |
0 |
| RDB$RELATION_FIELDS| 13 | 0 | 0 | 0 |
0 |
| RDB$RELATIONS| 2 | 0 | 0 | 0 |
0 |
| RDB$RELATION_CONSTRAINTS| 1 | 0 | 0 | 0 |
0 |
| SYS_BARCODE| 7,556,594 | 0 | 0 | 0 |
0 |
| SYS_PRODUCTS| 0 | 397 | 0 | 0 |
0 |
+--------------------------+-------+-----------+---------+---------+--------
--+
I'm wondering why in FB2 database for SYS_BARCODE read index for 7,5 million
times??
Should I modify query or ???
TIA
Paul
I have a production db on FB 1.5.3 SS Windows XP, works verry well and a
test db on FB 2.0 beta 2 SS on a Suse 9.2 (without NTPL).
On FB2 database are same structure, index, etc,etc and I have imported data
from FB 1.5.3
I have notice a verry bi difference running same query :
select * from sys_products where barcode not in
(select barcode from sys_barcode
group by barcode having count(barcode)>1
PLAN (SYS_BARCODE ORDER SYS_BARCODE_BARCODE))PLAN (SYS_PRODUCTS NATURAL)
On FB 1.5.3 query runs in 2.5 sec and on FB 2 in 210 seconds.
I have analyze those results and I see this difference.
Analysis for FB1.5.3
Query Time
------------------------------------------------
Prepare : 16
Execute : 62
Avg fetch time: 2.58 ms
Memory
------------------------------------------------
Current: 1,051,640
Max : 1,182,124
Buffers: 2,048
Operations
------------------------------------------------
Read : 0
Writes : 4
Fetches: 3,490
Plan:
------------------------------------------------
PLAN (SYS_BARCODE ORDER SYS_BARCODE_BARCODE)
PLAN (SYS_PRODUCTS NATURAL)
Enchanced Info:
+--------------------------+-------+-----------+---------+---------+--------
--+
| Table Name | Index | Non-Index | Updated | Deleted |
Inserted |
| | reads | reads | | |
|
+--------------------------+-------+-----------+---------+---------+--------
--+
| RDB$FIELDS| 13 | 0 | 0 | 0 |
0 |
| RDB$INDEX_SEGMENTS| 1 | 0 | 0 | 0 |
0 |
| RDB$INDICES| 1 | 0 | 0 | 0 |
0 |
| RDB$RELATION_FIELDS| 13 | 0 | 0 | 0 |
0 |
| RDB$RELATIONS| 3 | 0 | 0 | 0 |
0 |
| RDB$RELATION_CONSTRAINTS| 1 | 0 | 0 | 0 |
0 |
| SYS_BARCODE| 454 | 0 | 0 | 0 |
0 |
| SYS_PRODUCTS| 0 | 397 | 0 | 0 |
0 |
+--------------------------+-------+-----------+---------+---------+--------
--+
Analysis for FB2
Query Time
------------------------------------------------
Prepare : 32
Execute : 210,812
Avg fetch time: 210,812.00 ms
Memory
------------------------------------------------
Current: 855,376
Max : 890,348
Buffers: 2,048
Operations
------------------------------------------------
Read : 0
Writes : 76
Fetches: 2.270033E7
Plan:
------------------------------------------------
PLAN (SYS_BARCODE ORDER SYS_BARCODE_BARCODE)
PLAN (SYS_PRODUCTS NATURAL)
Enchanced Info:
+--------------------------+-------+-----------+---------+---------+--------
--+
| Table Name | Index | Non-Index | Updated | Deleted |
Inserted |
| | reads | reads | | |
|
+--------------------------+-------+-----------+---------+---------+--------
--+
| RDB$FIELDS| 13 | 0 | 0 | 0 |
0 |
| RDB$INDEX_SEGMENTS| 1 | 0 | 0 | 0 |
0 |
| RDB$INDICES| 1 | 0 | 0 | 0 |
0 |
| RDB$RELATION_FIELDS| 13 | 0 | 0 | 0 |
0 |
| RDB$RELATIONS| 2 | 0 | 0 | 0 |
0 |
| RDB$RELATION_CONSTRAINTS| 1 | 0 | 0 | 0 |
0 |
| SYS_BARCODE| 7,556,594 | 0 | 0 | 0 |
0 |
| SYS_PRODUCTS| 0 | 397 | 0 | 0 |
0 |
+--------------------------+-------+-----------+---------+---------+--------
--+
I'm wondering why in FB2 database for SYS_BARCODE read index for 7,5 million
times??
Should I modify query or ???
TIA
Paul