|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
||||
|
||||
|
Can you check it's explain plan?
__________________
My blog Tutorials about OSS databases, DBMonster ... Contribute to OSS Development, fill bug reports! Developer Shed eSupport Commented my.ini/my.cnf (ADD YOUR OWN CONFIG TRICK) An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries Don't turn your outer joins into inner joins Random data (with a bias) |
![]() |
| Viewing: Dev Shed Forums > Databases > Firebird SQL Development > Optimize Query with Left Join |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|