Subject | Help creating expression index |
---|---|
Author | Mr. John |
Post date | 2019-07-17T15:54:29Z |
Hi
I want to create a index to improve a query like that:
SELECT * FROM MYTABLE WHERE EXTRACT(YEAR FROM datein)=2019 AND EXTRACT(MONTH FROM datein)=1
I can create this index:
CREATE DESCENDING MYINDEX ON MYTABLE COMPUTED BY (EXTRACT(YEAR FROM datein) || EXTRACT(MONTH FROM datein) )
and change the query:
SELECT * FROM MYTABLE WHERE EXTRACT(YEAR FROM datein)|| EXTRACT(MONTH FROM datein)='20191'
index is used,but don't think this is the solution
thanks for any help