I have a select statement that takes a long time to run because I have loads of data in the table. It takes easily 10 to 15 minutes to return values...
Here is my select statement. The name of the table is "logs", the timestamp is set to 4 a.m. on Monday (today)... I'm trying to get the count of items in the table "before" the given timestamp. Any ideas how I can make this faster?
select my_id, count(distinct uid) from logs where (timestamp('2007-07-16-04.00.00.000000') - version) >= 0 group by my_id
my_id ==> CHARACTER(4)
uid ==> CHARACTER(20)
version ==> TIMESTAMP