0

I need to retrieve records from two tables and group them by date. I use a LEFT JOIN to get the data but I was wondering whether I should use

DISTINCT DATE(t1.date)

or

GROUP BY DATE(t1.date)

Which one is faster?

santa
  • 12,234
  • 49
  • 155
  • 255
  • This post will help http://stackoverflow.com/questions/581521/whats-faster-select-distinct-or-group-by-in-mysql – Samir Selia Jul 26 '15 at 19:00
  • well... there is that: [take a look](http://stackoverflow.com/questions/164319/is-there-any-difference-between-group-by-and-distinct) – classicalConditioning Jul 26 '15 at 19:01
  • Those ^ but personally I'm always a fan of testing it myself. In PHP I would use something described here: http://stackoverflow.com/questions/4501876/how-to-get-the-execution-time-of-a-mysql-query-from-php and compare both the queries, give them a very large sample size to really highlight the differences. – ZeroBased_IX Jul 26 '15 at 19:03

0 Answers0