Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

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:
Dell PowerEdge Servers
  #1  
Old August 28th, 2003, 02:03 PM
matu matu is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 6 matu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Table Update Speed Problem

Hi All ,
I need an answer.I have tried everything in the Book to speed up updates to My MSAccess SQL table.Indexes , and transactions . You can see the Big SQL statement (lots of Join Statements) in the "Where " clause.

i loop through the recordset returned by this query and for each record update some other table.(see the While Loop enveloped in transactions and i use the DBSQLPASSTHROUGH option for each update.This option does not load the Jet database Engine and i think what is does is to directly invoke functions implemented in the ODBC Driver--- in other words sidesteps one layer).

Then Why in the world does this update take time.It is very slow.Even the application,seems to hang.Conceptually , I understand that for each value to be updated in the
table a radom access is made to that record(records may be in non-Sequential locations).But then what is the solution??????????????????????????????????????????????????/

'******************************SEE the CODE BELOW**********************************


str1 = "SELECT D.CustGrp, D.CustCombo ,D.MktArea,D.OrderSize, D.ProdClass as Prod, P.RET_PRICE AS retail,((DB.MDemand + DB.SDemand )* P.RET_PRICE * (PT.EP_DISCNT/100) * (PT.EP_MAX_DAY/100)) as EPD " & _
"FROM DemandData AS D, ProdInfo AS P ,detailedBreakdowns as DB ,PAYTERMS as PT " & _
"Where d.ProdClass = p.PROD_CLASS and d.CustCombo = DB.CustCombo and d.OrderSize = DB.OrderSize and d.Mktarea = DB.MarketArea and PT.Cust_Group = D.CustGrp;"



Set rsEPD = cnxn.OpenRecordset(str1, , dbSQLPassThrough)
sum = 0

While (rsEPD.EOF <> True)

str2 = "Update detailedBreakDowns as D " & _
"Set EPmtDiscount = " & rsEPD!EPD & " " & _
"Where D.CustCombo = " & rsEPD!CustCombo & " and D.OrderSize = " & rsEPD!OrderSize & " and D.MarketArea = " & rsEPD!MktArea & " "


cnxn.Execute str2, dbSQLPassThrough

sum = sum + rsEPD!EPD

rsEPD.MoveNext

Wend



rsEPD.Close

Reply With Quote
  #2  
Old August 28th, 2003, 02:55 PM
Kronique Kronique is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Danbury,CT
Posts: 14 Kronique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
try this composite query instead of a recordset

Update detailedBreakDowns TAB2
Set EPmtDiscount = (select TAB1.EPD
from
(SELECT D.CustGrp, D.CustCombo ,D.MktArea,D.OrderSize, D.ProdClass as Prod, P.RET_PRICE AS retail,((DB.MDemand + DB.SDemand )* P.RET_PRICE * (PT.EP_DISCNT/100) * (PT.EP_MAX_DAY/100)) as EPD
FROM DemandData AS D, ProdInfo AS P ,detailedBreakdowns as DB ,PAYTERMS as PT
Where d.ProdClass = p.PROD_CLASS and d.CustCombo = DB.CustCombo and d.OrderSize = DB.OrderSize and d.Mktarea = DB.MarketArea and PT.Cust_Group = D.CustGrp) TAB1,detailedBreakDowns TAB2
where TAB2.CustCombo =TAB1.CustCombo and TAB2.OrderSize=TAB1.OrderSize and TAB2.MarketArea=TAB1.MARKETAREA)

Reply With Quote
  #3  
Old August 28th, 2003, 03:11 PM
matu matu is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 6 matu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
hi kronique ,
I need some explanation.I understand that this is a Select query as a nested query to the Update Query.Is this availabale in standard SQL.
further , what if more than 1 field is updated.
Will get back to you again,after i try this
thanks a lot

Reply With Quote
  #4  
Old August 28th, 2003, 04:49 PM
Kronique Kronique is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Danbury,CT
Posts: 14 Kronique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
well i think if you are using oracle as db, this would work. if it is say SQL server, u can recreate this same using the query designer, where they allow a join while creating an update statement

Reply With Quote
  #5  
Old August 28th, 2003, 04:52 PM
matu matu is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 6 matu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Well , i am using an MSAccess database???????????

Reply With Quote
  #6  
Old August 28th, 2003, 04:58 PM
Kronique Kronique is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Danbury,CT
Posts: 14 Kronique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
hello, i just noticed something in this query

str1 = "SELECT D.CustGrp, D.CustCombo ,D.MktArea,D.OrderSize, D.ProdClass as Prod, P.RET_PRICE AS retail,((DB.MDemand + DB.SDemand )* P.RET_PRICE * (PT.EP_DISCNT/100) * (PT.EP_MAX_DAY/100)) as EPD " & _
"FROM DemandData AS D, ProdInfo AS P ,detailedBreakdowns as DB ,PAYTERMS as PT " & _
"Where d.ProdClass = p.PROD_CLASS and d.CustCombo = DB.CustCombo and d.OrderSize = DB.OrderSize and d.Mktarea = DB.MarketArea and PT.Cust_Group = D.CustGrp;"

you have specified inner joins with oracle syntax, use access syntax like 'INNER JOIN DemandData on ProdInfo.prodclass=DemandData.prodclass

Reply With Quote
  #7  
Old August 28th, 2003, 05:59 PM
Kronique Kronique is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Danbury,CT
Posts: 14 Kronique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
hello, i just noticed something in this query

str1 = "SELECT D.CustGrp, D.CustCombo ,D.MktArea,D.OrderSize, D.ProdClass as Prod, P.RET_PRICE AS retail,((DB.MDemand + DB.SDemand )* P.RET_PRICE * (PT.EP_DISCNT/100) * (PT.EP_MAX_DAY/100)) as EPD " & _
"FROM DemandData AS D, ProdInfo AS P ,detailedBreakdowns as DB ,PAYTERMS as PT " & _
"Where d.ProdClass = p.PROD_CLASS and d.CustCombo = DB.CustCombo and d.OrderSize = DB.OrderSize and d.Mktarea = DB.MarketArea and PT.Cust_Group = D.CustGrp;"

you have specified inner joins with oracle syntax, use access syntax like 'INNER JOIN DemandData on ProdInfo.prodclass=DemandData.prodclass

Reply With Quote
  #8  
Old August 28th, 2003, 06:21 PM
matu matu is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 6 matu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I will work on this tomorow.I am tooo tired now,
bye and thanks ,, will let u know tomorow.
matu

Reply With Quote
  #9  
Old September 10th, 2003, 07:18 PM
matu matu is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 6 matu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I run this query as it is (with a correction on the name of the field name which was TAB1.MarketArea and should have been TAB1.Mktarea. And it gives me an error saying

"Operation must be an Updateable query"

so whats the deal with permissions here??/
Other than this query i can update a table , but dont know whats wrong here??

Also does an INNER JOIN work faster than an Oracle Style Join or What ???///

thanks much
matu


Update detailedBreakDowns TAB2
Set EPmtDiscount = (select TAB1.EPD
from
(SELECT D.CustGrp, D.CustCombo ,D.MktArea,D.OrderSize, D.ProdClass as Prod, P.RET_PRICE AS retail,((DB.MDemand + DB.SDemand )* P.RET_PRICE * (PT.EP_DISCNT/100) * (PT.EP_MAX_DAY/100)) as EPD
FROM DemandData AS D, ProdInfo AS P ,detailedBreakdowns as DB ,PAYTERMS as PT
Where d.ProdClass = p.PROD_CLASS and d.CustCombo = DB.CustCombo and d.OrderSize = DB.OrderSize and d.Mktarea = DB.MarketArea and PT.Cust_Group = D.CustGrp) TAB1,detailedBreakDowns TAB2
where TAB2.CustCombo =TAB1.CustCombo and TAB2.OrderSize=TAB1.OrderSize and TAB2.MarketArea=TAB1.MktArea);

Reply With Quote
  #10  
Old September 10th, 2003, 11:05 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,549 Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 4 Weeks 15 h 37 m 42 sec
Reputation Power: 634
More than likely your updateable query error is a permissions problem. The windows user that's running your program needs read/write access to the .mdb file. This is common with asp apps when the IIS user account isn't able to write to the db file.

Reply With Quote
  #11  
Old September 11th, 2003, 10:33 AM
matu matu is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 6 matu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi ,
I have been able to create temporary tables and delete them before , but only when i update a table using a "Update- Select Query " , am i not able to update the table.thanks so much ,
Regards ,
Utpal

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Table Update Speed Problem


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

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway