Afficher un message
Vieux 04/10/2007, 15h44   #4
Captain Paralytic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Speeding up large query

On 4 Oct, 15:27, nk <nkoell...@gmail.com> wrote:
> On Oct 4, 3:58 pm, Captain Paralytic <paul_laut...@yahoo.com> wrote:> Well,
> > since your where clause operates on field2 of second_table, could you
> > swap the tables round and use an index on field2 to limit the rows to
> > be operated on?

>
> > As it is, all the rows in main_table have to be read, a JOIN attempted
> > into second_table and, if the JOIN is successful, field2 must be
> > examined.

>
> Wouldn't this prevent me from using the index on sort_field, though?


Yes, but I don't know what the data looks like. It may be quicker to
do a filesort than to have to read all the records in main_table.

How many records in second_table have l.field2 = "abcde"?

  Réponse avec citation
 
Page generated in 0,04683 seconds with 9 queries