Subject | Query optimatization |
---|---|
Author | Szalai Kálmán |
Post date | 2004-11-12T12:03:19Z |
Hello!
Are there any way to optimize this query?
"select distinct extract(year from evttime) a,extract(month from
evttime) b,extract(day from evttime) c from events where extract(year
from evttime)=2004 and
extract(month from evttime)=09 and empid=41"
It makes lot of Non indexed reads on EVENTS table.
Currently I have got 2 Index and one primary key on this table:
DDLs:
ALTER TABLE EVENTS ADD PRIMARY KEY (EVTID);
CREATE INDEX IDX_EVENTS_EVTTIME ON EVENTS (EVTTIME);
CREATE DESCENDING INDEX NEWEVTID ON EVENTS (EVTID);
So how can I speed up? How can I turn non indexed reads to indexed reads?
Thanks,
KAMI
Are there any way to optimize this query?
"select distinct extract(year from evttime) a,extract(month from
evttime) b,extract(day from evttime) c from events where extract(year
from evttime)=2004 and
extract(month from evttime)=09 and empid=41"
It makes lot of Non indexed reads on EVENTS table.
Currently I have got 2 Index and one primary key on this table:
DDLs:
ALTER TABLE EVENTS ADD PRIMARY KEY (EVTID);
CREATE INDEX IDX_EVENTS_EVTTIME ON EVENTS (EVTTIME);
CREATE DESCENDING INDEX NEWEVTID ON EVENTS (EVTID);
So how can I speed up? How can I turn non indexed reads to indexed reads?
Thanks,
KAMI