Re: [PHP-DB] Group by

[email protected] ("[email protected]")
Newsgroups php.db
Message-ID <[email protected]>
The only SELECT is on MAX('timestamp').  There is really nothing to 
Group BY in this query.

Dewey

Philip Thompson wrote:
> Hi.
>
> In a mysql query, it is recommended that "GROUP BY" fields be indexed? Using EXPLAIN on one of my queries, I noticed no change between having indexed by GROUP BY field and not indexing it. Any thoughts would be appreciated.
>
> In this example, should `history_field` be indexed...?
>
> SELECT MAX(`timestamp`) AS `max_ts` 
> FROM `history` 
> WHERE `req_id` = 17 AND `history_record_id` = 35
> GROUP BY `history_field`
>
> Thanks,
> ~Philip
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.