Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 16th, 2006, 06:37 AM
srayner srayner is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2006
Posts: 4 srayner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 42 m 47 sec
Reputation Power: 0
Optimize Query with Left Join

Can anyone give me any tips on making this query perform better;

SELECT
GROUP_UNITY.DESCRIPTION,
Count(LOCATION.SERIAL_NUM)
FROM
LOCATION
INNER JOIN SERIAL_NOS ON LOCATION.SERIAL_NUM = SERIAL_NOS.SERIAL_NUM
LEFT JOIN GROUP_UNITY ON SERIAL_NOS.GROUP_REF = GROUP_UNITY.REF
WHERE
LOCATION.DATE_ENTER >= '09-Oct-2006' AND
LOCATION.DATE_ENTER <= '14-Oct-2006' AND
LOCATION.WAREHOUSE = 'ZZ'
GROUP BY
GROUP_UNITY.DESCRIPTION
ORDER BY
GROUP_UNITY.DESCRIPTION

if i change the left join to an inner join it performs much better, but does not return all the records.

Reply With Quote
  #2  
Old October 16th, 2006, 08:44 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,907 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 3 Weeks 3 Days 9 h 21 m 6 sec
Reputation Power: 279
Can you check it's explain plan?

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Optimize Query with Left Join


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT