Subject | Re: [firebird-support] FireBird : Table Setup, Views and Slow Queries |
---|---|
Author | Aage Johansen |
Post date | 2004-04-08T18:25:57Z |
On Thu, 8 Apr 2004 17:38:17 +0000 (UTC), Werner Cloete wrote:
What tools do you use? It's quite easy to paste a query into the cursor
pane of IB_SQL and click the prepare button - the plan will then appear in
the lower part.
The plan might suggest where indexes will speed up the query.
About the joins:
criteria (implicit) in the where clause.
Something like (as you did in the view definition):
-------
select ...
from INSPECTIONS join PROPERTIES on PROPERTIES.ID = INSPECTIONS.PROPERTY_ID
...
where INSPECTIONS.INSPECTION_ID = 23
and ...
-------
Don't know whether it helps, but it can make for easier understanding.
--
Aage J.
>You will only have to _prepare_ the query to get at the plan.
> Please excuse my ignorance...but do you mean that I should join the
> views into the query..? I'll have a look at that this evening...
>
> I will also try to get the plan for you...but, as mentioned in my
> previous post, it brings my computer to a near-halt for a _very_ long
> time...
>
What tools do you use? It's quite easy to paste a query into the cursor
pane of IB_SQL and click the prepare button - the plan will then appear in
the lower part.
The plan might suggest where indexes will speed up the query.
About the joins:
> select ...This is were I suggested to use explicit joins, and not having join
> from INSPECTIONS, PROPERTIES,
> PROPERTY_OWNERS, OWNERS,
> PROPERTY_BUYERS, BUYERS,
> PROPERTY_AGENTS, AGENTS,
> COMPANIES
> where INSPECTIONS.INSPECTION_ID = 23 and
> PROPERTIES.ID = INSPECTIONS.PROPERTY_ID and
> PROPERTY_OWNERS.PROPERTY_ID = PROPERTIES.ID and
> OWNERS.ENTITY_ID = PROPERTY_OWNERS.ENTITY_ID and
> PROPERTY_BUYERS.PROPERTY_ID = PROPERTIES.ID and
> BUYERS.ENTITY_ID = PROPERTY_BUYERS.ENTITY_ID and
> PROPERTY_AGENTS.PROPERTY_ID = PROPERTIES.ID and
> AGENTS.ENTITY_ID = PROPERTY_AGENTS.ENTITY_ID and
> COMPANIES.ID = AGENTS.COMPANY_ID
criteria (implicit) in the where clause.
Something like (as you did in the view definition):
-------
select ...
from INSPECTIONS join PROPERTIES on PROPERTIES.ID = INSPECTIONS.PROPERTY_ID
...
where INSPECTIONS.INSPECTION_ID = 23
and ...
-------
Don't know whether it helps, but it can make for easier understanding.
--
Aage J.