Subject | [firebird-support] Re: slow query |
---|---|
Author | Svein Erling Tysvaer |
Post date | 2009-08-08T00:04:46Z |
What's the reported plan (and query speed) if you try
SELECT *
FROM BILLING_IMG_TABLE
WHERE LOCATION = 'XX' AND NUMBER = 123 AND IMAGE_TYPE = 'XX'
ORDER BY AS$IMAGE_NUMBER+0;
I wonder whether the reported plan is different with the above query for
quick and slow computers.
HTH,
Set
PS! One thing that I've found really slows thing down with Firebird 1.5,
is indexed fields that contains lots of NULL. Not that I think this is
your problem.
Stephen Boyd wrote:
SELECT *
FROM BILLING_IMG_TABLE
WHERE LOCATION = 'XX' AND NUMBER = 123 AND IMAGE_TYPE = 'XX'
ORDER BY AS$IMAGE_NUMBER+0;
I wonder whether the reported plan is different with the above query for
quick and slow computers.
HTH,
Set
PS! One thing that I've found really slows thing down with Firebird 1.5,
is indexed fields that contains lots of NULL. Not that I think this is
your problem.
Stephen Boyd wrote:
> I have refreshed the index in question. RDB$STATISTICS now shows 2.9E-7 rather than 4.6E-7 so, if I understand this stuff correctly, that should indicate that it is more selective than it was before. However, the query is still SLOW unless I specifically add the index to the query using the PLAN clause. What else might be causing this?
>
> Here are the statistics for the index in question.
>
> Index BILLING_PRO_KEY (7)
> Depth: 3, leaf buckets: 7981, nodes: 4601270
> Average data length: 3.00, total dup: 1160727, max dup: 170
> Fill distribution:
> 0 - 19% = 3
> 20 - 39% = 0
> 40 - 59% = 4101
> 60 - 79% = 1137
> 80 - 99% = 2740
>
> and the primary key, which is being used for the ORDER part of the plan.
>
> Index RDB$PRIMARY17 (0)
> Depth: 3, leaf buckets: 7018, nodes: 4601098
> Average data length: 1.00, total dup: 0, max dup: 0
> Fill distribution:
> 0 - 19% = 13
> 20 - 39% = 0
> 40 - 59% = 5265
> 60 - 79% = 1302
> 80 - 99% = 438