Re: Group by

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Also you may not see a difference because your not even using
'History_field' anywhere in your SELECT statement. I am a little surprised
that you didn't receive a error.

On Wed, Dec 9, 2009 at 9:31 AM, Juan Pablo Ramirez <
ramirez.juanpablo@xxxxxxxxx> wrote:

> Hi i recommend always use indexes when programming. developers tend not
> to.. and when the databases grows it's difficult to modify or make them
> modify the code.
>
>
>
> El mié, 09-12-2009 a las 14:22 -0300, Julio Araya escribió:
>  > On Wed, Dec 9, 2009 at 12:52 PM, Philip Thompson <
> philthathril@xxxxxxxxx> 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`
> >
> > always depends on how many records you have, if you have 100-1000
> > records is very diferent to 100000-500000
> >
> >
> > >
> > > Thanks,
> > > ~Philip
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> >
> >
> > --
> > Julio Araya C.                                                Linux User
> #386141
> > Memorista de Ingeniería Civil Informática          Ubuntu User #14778
> > Universidd Técnica Federico Santa María         Valparaíso - Chile
> >
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
<a href="http://www.c28.com/?adid=st&iid=19467";>
<img src="http://www.c28.com/images/banner_88x31.gif"; border="0" width="88"
height="31"></a>

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux