[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-db
Subject:    Re: [PHP-DB] query optimization - DB
From:       "Glen Synergy" <synergy.oz () gmail ! com>
Date:       2008-09-27 3:46:47
Message-ID: c8c5d7830809262046r5407f42dx849c0d8526b60f13 () mail ! gmail ! com
[Download RAW message or body]


MySQL < 5.0 can only use 1 index per table.
MySQL >= 5.0 can use more than one via an index merge.

http://dev.mysql.com/doc/refman/5.0/en/index-merge-optimization.html

On Sat, Sep 27, 2008 at 2:47 AM, Micah Gersten <micah@onshore.com> wrote:

> MySQL queries use 1 index per table, so to speed the query, we need to
> know what indices you have for the 2 tables.
>
> Thank you,
> Micah Gersten
> onShore Networks
> Internal Developer
> http://www.onshore.com
>
>
>
> Yves Sucaet wrote:
> > Oh, sorry I forgot to mention this. It's a MySQL database.
> >
> > ----- Original Message ----- From: "Micah Gersten" <micah@onshore.com>
> > To: "YVES SUCAET" <yves.sucaet@usa.net>
> > Cc: <php-db@lists.php.net>
> > Sent: Thursday, September 25, 2008 7:55 PM
> > Subject: Re: [PHP-DB] query optimization
> >
> >
> >> Other question is, what DB is this for?
> >>
> >> Thank you,
> >> Micah Gersten
> >> onShore Networks
> >> Internal Developer
> >> http://www.onshore.com
> >>
> >>
> >>
> >> YVES SUCAET wrote:
> >>> How could I rewrite the following query so it runs faster:
> >>>
> >>> select distinct location from blockunit where blockid in (
> >>>   select bu.blockid from blockunit bu inner join interactionparts ip on
> >>> (bu.blockid = ip.part)
> >>>   where ip.blockid in
> >>>
> >>>
> (110936,110937,111641,111642,113140,113141,114925,114926,121161,121162,124087,
> >>>
> >>>
> >>> 124088,124562,124563,133358,133359,133409,133410,135304,135305,136096)
> >>>   union
> >>>   select bu.blockid from blockunit bu
> >>>   where bu.blockid in
> >>>
> >>>
> (110936,110937,111641,111642,113140,113141,114925,114926,121161,121162,124087,
> >>>
> >>>
> >>> 124088,124562,124563,133358,133359,133409,133410,135304,135305,136096)
> >>> )
> >>>
> >>> Thanks in advance,
> >>>
> >>> Yves
> >>>
> >>>
> >>>
> >>>
> >>
> >
> >
> >
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic