Full timestamp instead of date
Restructured code
Added indexes
Optimized query