|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Add condition makes sql so slow
don't know why
SELECT SPM.PLU, SPM.OWNERID, SPM.PROMID, S.DESCRIPTION, SP.FAMILY, SP.ORDERCODE, SPM.SUPPLIERID, PH.HOSTNUMBER, PH.PROMCODE, PH.PROMWEEK, PH.PROMZONE FROM PROMPRODHIST SPM JOIN SUPPLIERPROD SP ON( SP.OWNERID = 'G0000029' ) AND( SPM.OWNERID = SP.OWNERID ) AND( SPM.SUPPLIERID = SP.SUPPLIERID ) AND( SPM.PLU = SP.PLU ) JOIN PROMHEADER PH ON( PH.OWNERID = SPM.OWNERID ) AND( PH.PROMID = SPM.PROMID ) JOIN STDPROD S ON( SPM.PLU = S.PLU ) PLAN JOIN (SP INDEX (RDB$PRIMARY548),S INDEX (RDB$PRIMARY152),SPM INDEX (IDX_PROMPRODHIST_1),PH INDEX (RDB$PRIMARY554)) add the condition, the sql will be very slow , any idea here? Thx Roc |
|
#2
|
|||
|
|||
|
Have you tried:
WHERE ( SPM.OWNERID = 'G0000029' ) ? Is SPM.OWNERID the primary key? |
|
#3
|
|||
|
|||
|
Yes, SPM.OWNERID is the previous one,
still very slow, so I changed like this, all the fields of SPM used in the sql is primary key. |
|
#4
|
|||
|
|||
|
so strange, I only heard that adding conditions will make quicker, never see like this.
|
|
#5
|
||||
|
||||
|
Can you post a script for us to reproduce the problem?
__________________
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) |
|
#6
|
|||
|
|||
|
sorry for being offtopic, i'm too beginner to be able to help you, just wanted to ask what does that PLAN thing mean there?
and do you write that manually or some SQL editor did that? Quote:
|
|
#7
|
||||
|
||||
|
Quote:
Why don't you open another thread asking what an explain plan is, how to have the database spit it out and, last but not least, how to read it? |
![]() |
| Viewing: Dev Shed Forums > Databases > Firebird SQL Development > Add condition makes sql so slow |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|