I need help to increase this SQL-Statement. The runtime is about 125 ms.
At runtime of my program, this sql (better: equally structured sqls for different tables)
will be called 300,000 times.
The average number of rows in the tables is about 10,000,000 rows, and new rows (updates / inserts) will be added with a time stamp every day. The data that is interesting for this particular export program is in the last 1-3 days. Perhaps this is useful for creating an index. I need the current valid string for the given id and forerunner datarow to receive updates (if exists).
We use the Oracle 11g database and Dot.Net Framework 3.5
SQL statement to enhance:
select ID_SOMETHING, -- Number(12) ID_CONTRIBUTOR, -- Char(4 Byte) DATE_VALID_FROM, -- DATE DATE_VALID_TO -- DATE from TBL_SOMETHING XID where ID_SOMETHING = :ID_SOMETHING and ID_CONTRIBUTOR = :ID_CONTRIBUTOR and DATE_VALID_FROM <= :EXPORT_DATE and DATE_VALID_TO >= :EXPORT_DATE order by DATE_VALID_FROM asc;
Here I downloaded the current Explain-Plan for this request.
I am not a database expert, so I don’t know which index type is best suited for this requirement. I have seen that there are many different possible types of indexes that can be applied. Perhaps Oracle Optimizer hints are also helpful.
Does anyone have a good idea to configure this sql or can point me in the right direction?
Viper source share