Subject | Re: [firebird-support] Order by slows down query (FB 2.5 SC on Linux 64 bits) |
---|---|
Author | Mark Rotteveel |
Post date | 2011-05-04T07:49:20Z |
> The following query needs about 10 seconds to execute on a table withHave you updated the statistics on the indices of your database. Try and see if that improves things.
> around 7 Mio. lines:
>
> select * from lin_albaran_venta where nro_factura = '0000001' order by
> nro_albaran, nro_linea;
> Plan:
> PLAN (LIN_ALBARAN_VENTA ORDER PK_LIN_ALBARAN_VENTAPK INDEX
> (FK_LIN_ALBARAN_VENTA_13))
>
> When adding field nro_factura to the order by, the query speeds up to 0,2
> secs:
>
> select * from lin_albaran_venta where nro_factura = '0000001' order by
> nro_factura, nro_albaran, nro_linea;
> Plan:
> PLAN SORT ((LIN_ALBARAN_VENTA INDEX (FK_LIN_ALBARAN_VENTA_13)))
>
> nro_factura is a FK, and (nro_albaran, nro_linea) the PK of table
> LIN_ALBARAN_VENTA.
>
> We recently upgraded from FB 2.1 to 2.5, and on 2.1 we didn't run into
> this problem.
>
> Is there any solution to this, perhaps in the configuration file, or do we
> have to revise
> all the order by's in our application, or perhaps even go back to FB 2.1?
Mark
--
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de