Subject Re: [firebird-support] Query Performance - correlated subqueries and group by statements
Author Alexandre Benson Smith
Aaron Abend wrote:

>I set DefaultDbCachePages to a high (probably ridiculous) number - 40,000.
>FBServer is now using 50M, which is actually about where I want it. I
>believe the page size is the default. Could changing that help?
>
>
>
Don't do it !

set the cache page value to a maximum of 10000.

FB 1.5 and earlier have a not so good algorithm to handle a large number
of page buffers.

FB 2.0 removed this limit.

>Question: Does FB2.0 do anything new with correlated subqueries? We have
>tested by manually determining inner values and found that the individual
>queries are taking nanoseconds, but when the whole thing is put together as
>a correlated query, it tanks.
>
>
>
AFAIK no.

Can you change your correlated sub-queries to joins ? You will be amazed
by the performance diference.
example:

Select
Costumer.Name, Costumer.FirstSale
from
Costumer
where
Costumer.CityId in (select CityID from City where state = 'NY')

tend to be slow.

but
Select
Costumer.Name, Costumer.FirstSale
from
Costumer join
City on (City.CityID = Customer.CityID)
where
City.State = 'NY'

will be much faster !

>I will post our discoveries on this, or the code, depending on what we
>learn.
>
>Thanks,
>
>Aaron Abend
>
>

see you !

--

Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br