Subject Re: [firebird-support] Re: Optimizing a query
Author Martijn Tonies
Hi,

>
> > SELECT FIRST 20 SKIP 0 * from ASSET_LIST_GET_PRC();

Instead of doing the FIRST 20 here, I suggest you do that in your
Stored Procedure, that should be faster. Let me know the results.

> > The query is taking 34 minutes to run, which clearly isn't going to
> work.
>
> Tell your users they are being impatient :)
>
> > Here is the query:
> >
> > SELECT
> > ASSET.ASSET_ID,
> > ASSET.ASSET_SERIAL_NO,
> > CLIENT.CLIENT_NAME,
> > ASSET.PURCHASE_DATE,
> > ASSET_TYPE1.AT_NAME,
> > MODEL.MODEL_NO,
> > ASSET.DESCRIPTION
> > FROM
> > ASSET
> > INNER JOIN ASSET_TYPE ASSET_TYPE1 ON (ASSET.AT_ID =
> > ASSET_TYPE1.AT_ID)
> > INNER JOIN CLIENT ON (ASSET.FK_CLIENT_ID = CLIENT.CLIENT_ID)
> > INNER JOIN CLIENT_SITE ON (ASSET.FK_SITE_ID =
> CLIENT_SITE.SITE_ID)
> > INNER JOIN MODEL ON (ASSET.MODEL_ID = MODEL.MODEL_ID),
> > ASSET_TYPE
> > order by ASSET.ASSET_SERIAL_NO ASCENDING

No WHERE?

Martijn Tonies
Database Workbench - development tool for Firebird and more!
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com