Re: Query Optimising Problem !!
Posted in 1995
-> optimising query plans
There are some very simple places to start. Copy some of the
SELECTS from your program into DBACCESS and put 'set explain on;'
on the line above, then run the select. Look at a file called
sqlexplain.out which details the query plan Informix followed.
This is only from Version 4.0 onwards.
The first thing to eliminate is any sequential scans on large
tables by ensuring your selects use index paths. Where there is
no index pathfor a WHERE clause consider creating one.
Try to eliminate MATCHES and LIKE keyworkds from the slow SELECT
statements. Replace them with >= and <= and IN keywords.
Ensure you reguarly do an UPDATE STATISTICS especially if using
Informix ONLINE. This can make quite a difference.
The Informix SQL Reference and Tutorial have good chapters on
optimising code. Try small changes to your slow SELECTS in
dbaccess or isql and time the results (it is more accurate if you
always SELECT into a TEMP TABLE).
If using reports try to always ORDER EXTERNAL where possible and
use index fields for any ORDER BY or GROUP BY in selects. Paul