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 24th, 2006, 05:51 PM
heroes3lover heroes3lover is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2006
Posts: 3 heroes3lover User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 49 m 22 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old October 24th, 2006, 10:33 PM
clivew clivew is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2006
Location: Carlsbad, CA
Posts: 810 clivew User rank is Sergeant (500 - 2000 Reputation Level)clivew User rank is Sergeant (500 - 2000 Reputation Level)clivew User rank is Sergeant (500 - 2000 Reputation Level)clivew User rank is Sergeant (500 - 2000 Reputation Level)clivew User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 Days 5 h 46 m 49 sec
Reputation Power: 19
Have you tried:

WHERE ( SPM.OWNERID = 'G0000029' ) ?

Is SPM.OWNERID the primary key?

Reply With Quote
  #3  
Old October 25th, 2006, 01:19 AM
heroes3lover heroes3lover is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2006
Posts: 3 heroes3lover User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 49 m 22 sec
Reputation Power: 0
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.

Reply With Quote
  #4  
Old October 25th, 2006, 01:22 AM
heroes3lover heroes3lover is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2006
Posts: 3 heroes3lover User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 49 m 22 sec
Reputation Power: 0
so strange, I only heard that adding conditions will make quicker, never see like this.

Reply With Quote
  #5  
Old October 25th, 2006, 02:50 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 8 h 24 m 58 sec
Reputation Power: 279
Can you post a script for us to reproduce the problem?

Reply With Quote
  #6  
Old October 27th, 2006, 04:43 AM
nagysz nagysz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 46 nagysz User rank is Corporal (100 - 500 Reputation Level)nagysz User rank is Corporal (100 - 500 Reputation Level)nagysz User rank is Corporal (100 - 500 Reputation Level)nagysz User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 10 h 4 m 43 sec
Reputation Power: 4
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:
PLAN JOIN (SP INDEX (RDB$PRIMARY548),S INDEX (RDB$PRIMARY152),SPM INDEX (IDX_PROMPRODHIST_1),PH INDEX (RDB$PRIMARY554))

Reply With Quote
  #7  
Old October 28th, 2006, 07:38 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 8 h 24 m 58 sec
Reputation Power: 279
Quote:
Originally Posted by nagysz
sorry for being offtopic ...
Yes you are.
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?

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Add condition makes sql so slow


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 2 hosted by Hostway
Stay green...Green IT