In the last episode (Jul 28), [EMAIL PROTECTED] said:
> I think the UNION is the right way to handle this, in fact, I would be
> tempted to break it into 6 UNIONS... more on that later.

I think his 2 original unions should suffice.  Unions are great for
overcoming mysql's "one index per table" limitation when you have ORs in
your query referring to different fields.  You don't need to split up the
ORs within those WHERE clauses because they're all looking at the same
field.  You could even tidy the query up a bit by using the IN clause:

Where PRTC_DIALUP.Framed_IP_Address = 'someipaddress' 
AND PRTC_DIALUP.Date in ('one-date-here','one-day-earlier')

but that's just syntax changes.  Mysql will process it the same way.  Two
indexes, one on PRTC_DIALUP (Framed_IP_Address, Date) and the other on
PRTC_DSL (Framed_IP_Address, Date) should be all Christopher needs.

Also use the EXPLAIN command to find out exactly what MySQL decides to do
for the query.  Chapter 7.2 of the mysql manual covers this:

http://dev.mysql.com/doc/mysql/en/Query_Speed.html

-- 
        Dan Nelson
        [EMAIL PROTECTED]

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to