I run the very same query on two almost identical database. The only difference is that the first database has ID entries from 1 to 9000 for 2 tables while the other is in the 458231044 and 103511044 range for the 2 same tables. (for the same 9000 entries)
The query compares ID and UNIX time numerous times.
Running it on first database takes barely noticeable time. On the second, it takes 30s at the very least.
Is there a chance the problem is caused by the large numbers comparison? If so, how do you fix it? Would comparing string be faster?