Sunday, November 18, 2007

[firebird-support] Re: How to optimize this query using Firebird?

The plan for this particular case (two data conditions) is:

PLAN JOIN (C5 INDEX (IX_PV_LOOKUP_PD_DATA_TARGETVER), C4 INDEX
(IX_DV_PV_PV), C2 INDEX (PK_DV_PV), C3 INDEX (PK_PV_TIMESTAMP))

The query processing starts from C5. This can be a good or bad
choice. Because IX_PV_LOOKUP_PD_DATA_TARGETVER is unique, no more
than one row is found in C5. But the join to C4 (DV_PV) can produce
hundreds of thousands of rows indicating that very many object
versions meet this condition. This fact can kill the overall query
performance because these rows are used in joining to C2 (DV_PV) and
finally to C3 for checking the second (timestamp) condition. If the
initial guess is bad, the database is subject to a big amount of
index seeks even though there are a few results in the result set.

Hopefully you understand this query structure. If there were three
data conditions instead of two, performance problems could be even
worse because of more joins involved.

Timo

__._,_.___
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu.  Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Recent Activity
Visit Your Group
Sitebuilder

Build a web site

quickly & easily

with Sitebuilder.

Search Ads

Get new customers.

List your web site

in Yahoo! Search.

Featured Y! Groups

and category pages.

There is something

for everyone.

.

__,_._,___

No comments: