I have a table t1 and two indexes:
create index if not exists timeindex on t1(time, "Bytes Received")
create index if not exists filenameindex on t1(filename)
The next query executes fast enough:
select "Bytes Received" from t1 where time>="11:19:31.18" and time <= "11:19:36.18"
But when I add an additional condition to WHERE statement the query slows down tremendously
select "Bytes Received"
from t1
where time>="11:19:31.18" and time <= "11:19:36.18"
and filename = "SE12.log"
I’ve tried to create a new index t1(time, "Bytes Received", filename) but execution speed didn’t changed.
How should I change the indexes in the table to speed up the query?
Use
BETWEENand the following index:Also note that in SQL strings are enclosed in simple quotes (double quotes are for table, schemas and column names).