Subject | query optimization- MAX() from .. WHERE |
---|---|
Author | tomjanczkadao |
Post date | 2010-08-18T09:07:36Z |
Hi
I've got table similar to the following example:
CREATE TABLE TEST_TAB (
ID INTEGER NOT NULL PRIMARY KEY,
NUMER INTEGER,
FOREIGN_KEY INTEGER);
CREATE DESCENDING INDEX TEST_TAB_IDX1 ON TEST_TAB (FOREIGN_KEY, NUMER);
and query like this:
select max(t.numer)
from test_tab t
where t.foreign_key = :some_value
PLAN (T INDEX (TEST_TAB_IDX1))
So it uses proper index but Performance Analysis shows lot of reads (as much as count() where foreign_key = :some_value).
Is it any way to improve this query performance
Regards, Tomek
I've got table similar to the following example:
CREATE TABLE TEST_TAB (
ID INTEGER NOT NULL PRIMARY KEY,
NUMER INTEGER,
FOREIGN_KEY INTEGER);
CREATE DESCENDING INDEX TEST_TAB_IDX1 ON TEST_TAB (FOREIGN_KEY, NUMER);
and query like this:
select max(t.numer)
from test_tab t
where t.foreign_key = :some_value
PLAN (T INDEX (TEST_TAB_IDX1))
So it uses proper index but Performance Analysis shows lot of reads (as much as count() where foreign_key = :some_value).
Is it any way to improve this query performance
Regards, Tomek