Subject Re: [firebird-support] FireBird : Table Setup, Views and Slow Queries
Author Aage Johansen
On Thu, 8 Apr 2004 10:14:14 +0000 (UTC), Werner Cloete wrote:

> ...
> select PROPERTIES.AGENT_REFERENCE,
> OWNERS.SURNAME as OWNER_SURNAME, OWNERS.INITIALS as
> OWNER_INITIALS, OWNERS.NAME as OWNER_NAME, OWNERS.COMPANY_NAME as
> OWNER_COMPANY_NAME,
> BUYERS.SURNAME as BUYER_SURNAME, BUYERS.INITIALS as
> BUYER_INITIALS, BUYERS.NAME as BUYER_NAME, BUYERS.COMPANY_NAME as
> BUYER_COMPANY_NAME,
> PROPERTIES.ADDRESS_ROAD,
> 'xxxxx' as OUR_REFERENCE /*Calculated via another process*/,
> INSPECTIONS.DATE_INSPECTED,
> COMPANIES.ELECTRICAL_INSPECTION_COMM as COMMISSION
> 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
> ...



Use explicit joins here as well, and post the PLAN for the slow query.


--
Aage J.