To:
[email protected]
Without digging into the distributions, the index that would may work best
for this query is on (enrollment_period, created_on desc), but would need
more info.
I would suggest that you post the query plan.
Make sure that you have PDQ set.
Are there many records where enrollment_period is null? You could try
turning this into a union, but that would cause complications with the skip/first constructs and may require the use of a temp table.
I would guess that you are using the "skip 300000 first 75" to page through
the results set. There may be better ways to do this that would involve a scroll cursor or putting the key fields in a temp table.
Mike
-----Original Message-----
From:
[email protected] [mailto:
[email protected]]
On Behalf Of
[email protected]
Sent: Tuesday, December 06, 2016 8:48 AM
To:
[email protected]
Subject: Informix Query Tuning
Hi
I have a table called lead, which have about 500 thousand records and we
need the following query to get executed.
SELECT skip 300000 first 75 * FROM lead WHERE ((enrollment_period IS NULL)
OR (enrollment_period IN ('FT2015','F16','SUM2016','FALL2016','FALL2017','SP17'))) ORDER BY
created_on DESC
The table lead has id column as the primary key and thus have clustered
index in that column. This query is taking about 12 - 13 mins. When I added
a non-clustered index on created_on and enrollment_period columns, it came
down to 4 - 5 mins. Then I changed the clustered index from id column to
this index, execution time came down further to about 50 seconds now.
Is there any other optimization scope available for this query? Overall, is there any other change that can be done so that the query will execute
faster?
Thanks in Advance,
Manohar
_______________________________________________
Informix-list mailing list
[email protected]
http://members.iiug.org/mailman/listinfo/informix-list
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)