473,397 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Optimization Help

Hi,

I have had to write a software with VisualBasic 6.0 and MS Access.

Now the database that I deal with has some 1 million records and I perform operations on this and based on certain criteria I need to look at a part of this table and generate a bunch of insert statements.

Overall there are some 100 thousand inserts followed by records getting deleted from the 1 million record table. The operation seems to fail because the MAX LOCKS are reached.

I solved this by editing the registry entry.

However the operation takes a few hours to complete. The main reason for this is the frequent INSERTS.

I just want to know if there is any way of optimizing this.
Nov 16 '07 #1
8 1587
Rabbit
12,516 Expert Mod 8TB
Hi,

I have had to write a software with VisualBasic 6.0 and MS Access.

Now the database that I deal with has some 1 million records and I perform operations on this and based on certain criteria I need to look at a part of this table and generate a bunch of insert statements.

Overall there are some 100 thousand inserts followed by records getting deleted from the 1 million record table. The operation seems to fail because the MAX LOCKS are reached.

I solved this by editing the registry entry.

However the operation takes a few hours to complete. The main reason for this is the frequent INSERTS.

I just want to know if there is any way of optimizing this.
We need the specifics if we're going to optimize anything. What records need to be inserted? How is that determined? How are those tables involved set up? What records need to be deleted? And probably, most important of all, why? Why do you need to do this? What is it you're looking to do, in a general context?
Nov 16 '07 #2
Firstly I am using MS ACCESS 2002 with VB6.0 front end.

I have a OrderDetail table with 1.4 million records.
In this I have 100000 unique combinations of (CutomerNo, Date and Route)
I have 15 Classes of Items and 10000 items in these classes.

So I have to take Orders from the OrderDetail based on the unique combination (CutomerNo, Date and Route) and within this I need to run thru each of the 15 item Class and check if one an of the 10000 items exists in this and PACKAGE it which is set of insert statements into another table.

In PACKAGE phase I have to look at the Qty for each Item and keep packing it in.

Now the final result for the PACKED table after I run is approximated at 200000 records. So thts how many inserts I have to do.

Now to start with I have a grouping of unique (CutomerNo, Date and Route) in query. In a loop I go thru this table and take group all the data that suffices into a temporary table then run thru this table for each ITEM CLASS and each item withing that (this is important to make sure about the stability) and each time I do i remove that row from that temporary table ( which means quite a few deletes too) and then the Item is PACKAGED (i.e inserted into the PACKAGE table)

I tried to work with the original table but the temporary table contains a few hundred records at a time and is faster to search when compared to 1.4 million records so for performance reasons had to do this.

Now I am having the problem of "System resources exceeded".

Do you ave any tips as to how I can improve this application??
Nov 22 '07 #3
Rabbit
12,516 Expert Mod 8TB
I'm finding it hard to follow what you're trying to do.

Can you give us a 1-2 sentence overview and walk us through an example?
Nov 22 '07 #4
Well Briefly I am doing an inventory management for a warehouse.

I am trying to build wht are called Pallets which are loaded to trucks and brought to Stores.

The PACKAGE building is building of such a pallet.

Now the Pallet building requires that we go thru OrderDetail table which has 1.4 million records approx.

And the rest is in my post before.

I hope this helps??
Nov 25 '07 #5
Jim Doherty
897 Expert 512MB
Firstly I am using MS ACCESS 2002 with VB6.0 front end.

I have a OrderDetail table with 1.4 million records.
In this I have 100000 unique combinations of (CutomerNo, Date and Route)
I have 15 Classes of Items and 10000 items in these classes.

So I have to take Orders from the OrderDetail based on the unique combination (CutomerNo, Date and Route) and within this I need to run thru each of the 15 item Class and check if one an of the 10000 items exists in this and PACKAGE it which is set of insert statements into another table.

In PACKAGE phase I have to look at the Qty for each Item and keep packing it in.

Now the final result for the PACKED table after I run is approximated at 200000 records. So thts how many inserts I have to do.

Now to start with I have a grouping of unique (CutomerNo, Date and Route) in query. In a loop I go thru this table and take group all the data that suffices into a temporary table then run thru this table for each ITEM CLASS and each item withing that (this is important to make sure about the stability) and each time I do i remove that row from that temporary table ( which means quite a few deletes too) and then the Item is PACKAGED (i.e inserted into the PACKAGE table)

I tried to work with the original table but the temporary table contains a few hundred records at a time and is faster to search when compared to 1.4 million records so for performance reasons had to do this.

Now I am having the problem of "System resources exceeded".

Do you ave any tips as to how I can improve this application??
My advice would be to get your company to invest in SQL Server your data size and transaction handling is much more suited to that platform

Jim
Nov 26 '07 #6
Rabbit
12,516 Expert Mod 8TB
You're going to have to walk me through an example because:

I don't know why you have to run through each of the 15 item classes and check the 10,000 items. I also don't know what you mean by "PACKAGE" it.
So I have to take Orders from the OrderDetail based on the unique combination (CutomerNo, Date and Route) and within this I need to run thru each of the 15 item Class and check if one an of the 10000 items exists in this and PACKAGE it which is set of insert statements into another table.
I don't know why you have to keep "packing it in" or what that entails.
In PACKAGE phase I have to look at the Qty for each Item and keep packing it in.
And you've completely lost me at this point.
Now the final result for the PACKED table after I run is approximated at 200000 records. So thts how many inserts I have to do.

Now to start with I have a grouping of unique (CutomerNo, Date and Route) in query. In a loop I go thru this table and take group all the data that suffices into a temporary table then run thru this table for each ITEM CLASS and each item withing that (this is important to make sure about the stability) and each time I do i remove that row from that temporary table ( which means quite a few deletes too) and then the Item is PACKAGED (i.e inserted into the PACKAGE table)
What I'm trying to figure out is what it is you're trying to do because it's all the individual inserts that are taking forever. If I knew what you're trying to do, then chances are you can boil it down to a few queries. Instead of 200,000 queries.
Nov 26 '07 #7
Expand|Select|Wrap|Line Numbers
  1. CustomerNo    Item    OrderDate    Qty    RouteNo    DeliveryMethod    DeliveryDescription
  2. 98134    3130    2/28/2006    14    488233    3    
  3. 98134    3155    2/28/2006    32    488233    3    
  4. 98134    32238    2/28/2006    12    488233    3    
  5. 98134    32240    2/28/2006    23    488233    3    
  6. 98134    33527    2/28/2006    21    488233    3    
  7. 98134    3685    2/28/2006    19    488233    3    
  8. 98134    63340    2/28/2006    22    488233    3    
  9. 98134    67543    2/28/2006    42    488233    3    
  10.  
This is a small test data I made for testing initially correctness of my algorithm.

Now if u observe just (CustomerNo, OrderDate, RouteNo) which from now on I call a TRIPLET. I have just one unique one
Expand|Select|Wrap|Line Numbers
  1. CustomerNo    RouteNo    OrderDate
  2. 98134    488233    2/28/2006
  3.  
A ITEMCLASS looks like this

Expand|Select|Wrap|Line Numbers
  1. ItemClass    OrderPlacement
  2. 12CAN               10
  3. 1LTR                 190
  4. 15LTR                180
  5. WMPL              100
  6. 2LTR                  50
  7. TRH                 999
  8. x                    998
  9.  
I have 15 such itemclasses.

Under each itemclass we have some 30-40 Items.

Expand|Select|Wrap|Line Numbers
  1. item    description    ItemClass    HazCode    ItemLength    ItemWidth    ItemHeight
  2. 62609    5G TK JOGUE CLUB SODA PRE    x        0    0    0
  3. 62496    14OZ NR CLRLY CNDIAN BLKBERRY     x        0    0    0
  4. 62497    14OZ NR CLRLY CNDIAN STRWML 1/    x        0    0    0
  5. 62498    14OZ NR CLRLY CNDIAN GRAPE 1/1    x        0    0    0
  6.  
there are some 10k such items belonging to different classes.

One specialty of an itemclass is that all the items in it will have the same dimensions.

Now a pallet is a single unit loaded on the truck for delivery to stores.
Usually a pallet has all the same type of items or the same itemclass.
So suppose we have say pepsi cans being loaded to a pallet, we check the available volume of the pallet and the volume of each can case(24 cans) and we fill the stuff up. Because the pallet has same item it will be homogeneous.
Now if a pallet has same itemclass items say Pepsi cans, diet pepsi cans, they will still be homogeneous.
But there is a small possibility that we have a half filled pallet of CANs and now we get bottle so in such a case we will need to compute the volume left and hence fill the bottles cases in such a case that (noOfBottles * Vol of Boittle) <= volumeLeftInPallet.
This is packaging.

Now when orders come from really small stores, then the same step gets broken down further say CANS,16oz bottles, 20oz bottle, and so on.

Hence we have another logical division of Layers, each pallet has approx 5 layers. Now I need to show layer by layer insertion. Which is causing the problem. Because in a order of 1.4 million we have some 50000 pallets and each with approx 5 layers ... well u have like 200000 inserts.

Apart from this for each unique TRIPLET, I insert into a temporary table all the records from the original table as this is all the pallets that will be put into a truck. (Because they are going to a particular customer on a particular date by a particular route.) which match and then within this I go thru the itemclass and then items and then make pallets or PACKAGE.

Well thanx a lot for trying to help me guys, its a complicated thing but I am trying my best to make you understand it.

Just let me know if you have some other question.
Nov 27 '07 #8
Rabbit
12,516 Expert Mod 8TB
Let's see if I'm understanding you correctly.

I'm dropping the Delivery fields because they don't seem to relate to the problem at hand.
Expand|Select|Wrap|Line Numbers
  1. CustomerNo  Item  OrderDate  Qty  RouteNo
  2. 12345       Item1 1/1/2007   3    Route1
  3. 12345       Item2 1/1/2007   5    Route1
  4. 12345       Item3 1/1/2007   1    Route1
  5. 54321       Item1 1/1/2007   2    Route1
  6. 54321       Item3 1/1/2007   3    Route1
  7.  
I'm dropping the Item Class stuff because I don't see how it relates to the problem.

Now you have the Item descriptions. Again I'm dropping fields not related to the problem at hand.
Expand|Select|Wrap|Line Numbers
  1. Item  Length  Width  Height
  2. Item1 2       3      1
  3. Item2 3       4      2
  4. Item3 2       2      2
  5.  
So, if I'm understanding correctly, you're trying to automatically package the items into pallets for a chosen triplet?
Nov 27 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Rune | last post by:
Is it best to use double quotes and let PHP expand variables inside strings, or is it faster to do the string manipulation yourself manually? Which is quicker? 1) $insert = 'To Be';...
12
by: WantedToBeDBA | last post by:
Hi all, db2 => create table emp(empno int not null primary key, \ db2 (cont.) => sex char(1) not null constraint s_check check \ db2 (cont.) => (sex in ('m','f')) \ db2 (cont.) => not enforced...
5
by: Praveen_db2 | last post by:
Dear All Db2 version: 8.1 OS: Windows I have 2 questions: 1) What is the optimizer which db2 uses, rule based or cost based? If any one can clear out the difference between the two it will be...
22
by: NigelW | last post by:
This is really a question for the development team. Are there plans to improve the optimization of C# to MSIL? I ask this, as inspection with ILDASM of the MSIL code shows that, even with the...
24
by: Kunal | last post by:
Hello, I need help in removing if ..else conditions inside for loops. I have used the following method but I am not sure whether it has actually helped. Below is an example to illustrate what I...
21
by: mjbackues at yahoo | last post by:
Hello. I'm having a problem with the Visual Studio .net (2003) C++ speed optimization, and hope someone can suggest a workaround. My project includes many C++ files, most of which work fine...
5
by: wkaras | last post by:
I've compiled this code: const int x0 = 10; const int x1 = 20; const int x2 = 30; int x = { x2, x0, x1 }; struct Y {
2
by: prakashtambare | last post by:
Hi all, Myself Prakash I am new to this forum and I am working as a software engineer but also I am just a fresher into the software industry, also my work is related to c source code optimization...
4
by: specialdosa | last post by:
We use DB2-LUW-8.2. I am doing some research on performance issues and I read about the "OPTIMIZATION LEVELS' and their impacts on Joins. How do I get the Optimization level implemented here?...
20
by: Ravikiran | last post by:
Hi Friends, I wanted know about whatt is ment by zero optimization and sign optimization and its differences.... Thank you...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.