Optimizing DISTINCT searches

2006-05-01 Thread Stephen P. Fracek, Jr.
Several of my DISTINCT searches are frequently showing up in the slow query log. These queries use multiple table joins. Using EXPLAIN shows that the queries are using the appropriate keys, as far as I know. Are DISTINCT searches using multiple joins slow? TIA. Stephen P. Fracek, Jr. [EMAIL

RE: Optimizing DISTINCT searches

2006-05-01 Thread Robert DiFalco
. Fracek, Jr. [mailto:[EMAIL PROTECTED] Sent: Monday, May 01, 2006 7:52 AM To: mysql@lists.mysql.com Subject: Optimizing DISTINCT searches Several of my DISTINCT searches are frequently showing up in the slow query log. These queries use multiple table joins. Using EXPLAIN shows that the queries

FW: Optimizing DISTINCT searches

2006-05-01 Thread Stephen P. Fracek, Jr.
On 2006-05-01 11:55 AM, Robert DiFalco [EMAIL PROTECTED] wrote: Well, normally a DISTINCT has to do a type of sort and is slower than non-DISTINCT queries. Each field of the result set is considered in the DISTINCT logic. Can you modify the query so that it does not require the DISTINCT? Can

RE: Optimizing DISTINCT searches

2006-05-01 Thread Robert DiFalco
@lists.mysql.com Subject: FW: Optimizing DISTINCT searches On 2006-05-01 11:55 AM, Robert DiFalco [EMAIL PROTECTED] wrote: Well, normally a DISTINCT has to do a type of sort and is slower than non-DISTINCT queries. Each field of the result set is considered in the DISTINCT logic. Can you modify

Re: Optimizing DISTINCT searches

2006-05-01 Thread Stephen P. Fracek, Jr.
On 2006-05-01 1:14 PM, Robert DiFalco [EMAIL PROTECTED] wrote: Would you need the DISTINCT if you change the query like so? SELECT Site.Site_ID, Site, Status, Type FROM Site JOIN Project ON Site.Site_ID = Project.Site_ID ORDER BY Site; You may also want to just try your initial query

RE: Optimizing DISTINCT searches

2006-05-01 Thread Robert DiFalco
, 2006 1:27 PM To: mysql@lists.mysql.com Subject: Re: Optimizing DISTINCT searches On 2006-05-01 1:14 PM, Robert DiFalco [EMAIL PROTECTED] wrote: Would you need the DISTINCT if you change the query like so? SELECT Site.Site_ID, Site, Status, Type FROM Site JOIN Project ON Site.Site_ID