Re: Dirt Slow Query On Datetime Range...the saga continues

2003-11-13 Thread Matt W
Matt - Original Message - From: "Gabriel Ricard" Sent: Wednesday, November 12, 2003 10:00 AM Subject: Re: Dirt Slow Query On Datetime Range...the saga continues > In order to make sure of a multi-column index, you have to order the > WHERE clauses in the same order as the

Re: Dirt Slow Query On Datetime Range...the saga continues

2003-11-12 Thread Gabriel Ricard
In order to make sure of a multi-column index, you have to order the WHERE clauses in the same order as the columns in the index. Since you query Realm first, then AcctStartTime, then AcctStopTime, MySQL would use an index on those columns in that order. You can either add a differently ordered

RE: Dirt Slow Query On Datetime Range...the saga continues

2003-11-11 Thread Michael Shuler
Thanks for the quick help everyone...OK I made a few changes The Query is now: SELECT COUNT( * ) AS CallCount FROM ServiceRADIUSAccounting WHERE (Realm = 'testrealm.com') AND ('2003-10-11 16:00:00' BETWEEN AcctStartTime AND AcctStopTime) Which uses the RealmAndStart index (which as you see in