473,401 Members | 2,146 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,401 software developers and data experts.

I though I had this one licked

Hi, I posted this a while ago, and I though I got a solution. I added
referencial intergrity between the tables "tblJobs" and
tblJobsLineItems" as was suggested. The time went to .5 seconds.
Great. Unfortunately, the speed only lasted while I was the only user.
As soon as someone else logs in, it goes in the tank.

The old post is listed below.

I have an append query that needs to run every time a line item is
added to a subform. The append writes to a table that is the source
for a pull down box. Problem is that it takes 5 seconds to run. This
makes adding lines to an order too slow for the users. The result of
the query provides real time availabilty, so I really do need this to
work.

The tblJobs has only 10,000 records, tblJobsLineItems has 150,000
records.
INSERT INTO tmpRaItemsInUseTotals ( [Item Number], SumOfQuantity )
SELECT DISTINCTROW tblJobsLineItems.[Item Number],
Sum(tblJobsLineItems.Quantity) AS SumOfQuantity
FROM tblJobs INNER JOIN tblJobsLineItems ON tblJobs.Job_Num =
tblJobsLineItems.Job_Num
WHERE (((tblJobs.Confirmed)<>"no") AND ((tblJobs.SetCall) Between
[Forms]![frmJobs]![SetCall] And [Forms]![frmJobs]![fldRTSCall])) OR
(((tblJobs.Confirmed)<>"no") AND ((tblJobs.fldRTSCall) Between
[Forms]![frmJobs]![SetCall] And [Forms]![frmJobs]![fldRTSCall])) OR
(((tblJobs.Confirmed)<>"no") AND
((tblJobs.SetCall)<[Forms]![frmJobs]![SetCall]) AND
((tblJobs.fldRTSCall)>[Forms]![frmJobs]![fldRTSCall]))
GROUP BY tblJobsLineItems.[Item Number];
Any ideas?

Dec 20 '06 #1
4 1163
pm********@gmail.com wrote:
INSERT INTO tmpRaItemsInUseTotals ( [Item Number], SumOfQuantity )
SELECT DISTINCTROW tblJobsLineItems.[Item Number],
Sum(tblJobsLineItems.Quantity) AS SumOfQuantity
FROM tblJobs INNER JOIN tblJobsLineItems ON tblJobs.Job_Num =
tblJobsLineItems.Job_Num
WHERE (((tblJobs.Confirmed)<>"no") AND ((tblJobs.SetCall) Between
[Forms]![frmJobs]![SetCall] And [Forms]![frmJobs]![fldRTSCall])) OR
(((tblJobs.Confirmed)<>"no") AND ((tblJobs.fldRTSCall) Between
[Forms]![frmJobs]![SetCall] And [Forms]![frmJobs]![fldRTSCall])) OR
(((tblJobs.Confirmed)<>"no") AND
((tblJobs.SetCall)<[Forms]![frmJobs]![SetCall]) AND
((tblJobs.fldRTSCall)>[Forms]![frmJobs]![fldRTSCall]))
GROUP BY tblJobsLineItems.[Item Number];

Any ideas?
a few ...

Does everyone have his/her own copy of the front end db?
--
Rewrite the SQL.
Can you manage to check tblJobs.Confirmed<>"no" only once?
Is tblJobs.Confirmed indexed?
Is there a good reason that tblJobs.Confirmed is Text and not Boolean?
Can you get rid of the [Forms]![frmJobs]![SetCall] syntax? If frmJobs
has a module then you can use Form_frmJobs.SetCall.Value which might
allow you to see exactly what you are doing. Better yet, use a query
string and enter the form values directly into the query string as
something like
AND tblJobs.fldRTSCall Between
Between " & Form_frmJobsRTSCall.Value & " And ..."
Get rid of the Access induced parentheses and put in your own so that
can see and understand the logic of the SQL.
Can you modify the SQL so that the ORs are minimized or at least
reduced to something like
A And B And (C Or D Or E Or F).
Can you try the SQL with the most likely OR first in the SQL? Does it
make a difference? What about last?
If all this temp table does is act as a candidate table and it is
created from a Select query why make the table at all when you can just
use the Select query as the Candidate data?
--
This stuff looks like pure Microsoft exemplary code. Microsoft's code
is written with the aim of convincing computer newbies that they can do
something with Access and should buy it. It is not written with the
idea of being efficient.

Referential integrity is unlikely to make things slower, not faster.
Probably, the RI resulted in an index or two being created and that
made your query quicker.

Before you try anything I have suggested do a search on me in Google.
Try to determine if I have any clue about what I am saying. If no then
pass on to some other suggestions. When one posts here often some
replies seem to make sense and others not. But those that make sense
may do so because the poster has the same understanding of a problem as
you do; which may mean that while they contribute a nice comfortable
answer for you, they may not have contributed one which is likely to
lead you to an effective and efficient solution.

Dec 20 '06 #2
Suggestions:

a) See Tony Toews's "Performance FAQ" at:
http://www.granite.ab.ca/access/performancefaq.htm
Work through each item in his list.

b) Do you have indexes for the fields used in the WHERE and GROUP BY clauses
of your query?

c) Optimize the WHERE clause. Be sure to use correct data types.
For example, if tblJobs.Confirmed is a yes/no field (not a Text field), use:
tblJobs.Confirmed <False
You can also avoid repeating many of those phrases if you rearrange the
WHERE clause.
It may also help to declare the 2 parameters if they are numbers or dates
(Parameters on Query menu, in query design view.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<pm********@gmail.comwrote in message
news:11**********************@t46g2000cwa.googlegr oups.com...
Hi, I posted this a while ago, and I though I got a solution. I added
referencial intergrity between the tables "tblJobs" and
tblJobsLineItems" as was suggested. The time went to .5 seconds.
Great. Unfortunately, the speed only lasted while I was the only user.
As soon as someone else logs in, it goes in the tank.

The old post is listed below.

I have an append query that needs to run every time a line item is
added to a subform. The append writes to a table that is the source
for a pull down box. Problem is that it takes 5 seconds to run. This
makes adding lines to an order too slow for the users. The result of
the query provides real time availabilty, so I really do need this to
work.

The tblJobs has only 10,000 records, tblJobsLineItems has 150,000
records.

INSERT INTO tmpRaItemsInUseTotals ( [Item Number], SumOfQuantity )
SELECT DISTINCTROW tblJobsLineItems.[Item Number],
Sum(tblJobsLineItems.Quantity) AS SumOfQuantity
FROM tblJobs INNER JOIN tblJobsLineItems ON tblJobs.Job_Num =
tblJobsLineItems.Job_Num
WHERE (((tblJobs.Confirmed)<>"no") AND ((tblJobs.SetCall) Between
[Forms]![frmJobs]![SetCall] And [Forms]![frmJobs]![fldRTSCall])) OR
(((tblJobs.Confirmed)<>"no") AND ((tblJobs.fldRTSCall) Between
[Forms]![frmJobs]![SetCall] And [Forms]![frmJobs]![fldRTSCall])) OR
(((tblJobs.Confirmed)<>"no") AND
((tblJobs.SetCall)<[Forms]![frmJobs]![SetCall]) AND
((tblJobs.fldRTSCall)>[Forms]![frmJobs]![fldRTSCall]))
GROUP BY tblJobsLineItems.[Item Number];

Any ideas?

Dec 20 '06 #3
Thanks for the comments.

There are indexes on everything with a join, where, or group by. The
logic is for determining whether an item is in use on a particular day.
Jobs can run days, weeks, or even months. So the logic has to check
all of these permutations.

The main point of the question was the degredation of performance when
a second users logs on. When it is single user, the performance is
great. When there is more than one, it is terrible.

Thanks,

Preston
Allen Browne wrote:
Suggestions:

a) See Tony Toews's "Performance FAQ" at:
http://www.granite.ab.ca/access/performancefaq.htm
Work through each item in his list.

b) Do you have indexes for the fields used in the WHERE and GROUP BY clauses
of your query?

c) Optimize the WHERE clause. Be sure to use correct data types.
For example, if tblJobs.Confirmed is a yes/no field (not a Text field), use:
tblJobs.Confirmed <False
You can also avoid repeating many of those phrases if you rearrange the
WHERE clause.
It may also help to declare the 2 parameters if they are numbers or dates
(Parameters on Query menu, in query design view.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<pm********@gmail.comwrote in message
news:11**********************@t46g2000cwa.googlegr oups.com...
Hi, I posted this a while ago, and I though I got a solution. I added
referencial intergrity between the tables "tblJobs" and
tblJobsLineItems" as was suggested. The time went to .5 seconds.
Great. Unfortunately, the speed only lasted while I was the only user.
As soon as someone else logs in, it goes in the tank.

The old post is listed below.

I have an append query that needs to run every time a line item is
added to a subform. The append writes to a table that is the source
for a pull down box. Problem is that it takes 5 seconds to run. This
makes adding lines to an order too slow for the users. The result of
the query provides real time availabilty, so I really do need this to
work.

The tblJobs has only 10,000 records, tblJobsLineItems has 150,000
records.

INSERT INTO tmpRaItemsInUseTotals ( [Item Number], SumOfQuantity )
SELECT DISTINCTROW tblJobsLineItems.[Item Number],
Sum(tblJobsLineItems.Quantity) AS SumOfQuantity
FROM tblJobs INNER JOIN tblJobsLineItems ON tblJobs.Job_Num =
tblJobsLineItems.Job_Num
WHERE (((tblJobs.Confirmed)<>"no") AND ((tblJobs.SetCall) Between
[Forms]![frmJobs]![SetCall] And [Forms]![frmJobs]![fldRTSCall])) OR
(((tblJobs.Confirmed)<>"no") AND ((tblJobs.fldRTSCall) Between
[Forms]![frmJobs]![SetCall] And [Forms]![frmJobs]![fldRTSCall])) OR
(((tblJobs.Confirmed)<>"no") AND
((tblJobs.SetCall)<[Forms]![frmJobs]![SetCall]) AND
((tblJobs.fldRTSCall)>[Forms]![frmJobs]![fldRTSCall]))
GROUP BY tblJobsLineItems.[Item Number];

Any ideas?
Dec 27 '06 #4
Well, there is much more that Access has to do in a multi-user setup, so it
normally does involve some hit.

But if the hit is huge, then you probably do have one of Tony's items to
deal with, such as longer path names on XP.

(It is possible to optimize that WHERE clause, and it could make a
difference, but you probably know that.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<pm********@gmail.comwrote in message
news:11**********************@73g2000cwn.googlegro ups.com...
Thanks for the comments.

There are indexes on everything with a join, where, or group by. The
logic is for determining whether an item is in use on a particular day.
Jobs can run days, weeks, or even months. So the logic has to check
all of these permutations.

The main point of the question was the degredation of performance when
a second users logs on. When it is single user, the performance is
great. When there is more than one, it is terrible.

Thanks,

Preston
Allen Browne wrote:
>Suggestions:

a) See Tony Toews's "Performance FAQ" at:
http://www.granite.ab.ca/access/performancefaq.htm
Work through each item in his list.

b) Do you have indexes for the fields used in the WHERE and GROUP BY
clauses
of your query?

c) Optimize the WHERE clause. Be sure to use correct data types.
For example, if tblJobs.Confirmed is a yes/no field (not a Text field),
use:
tblJobs.Confirmed <False
You can also avoid repeating many of those phrases if you rearrange the
WHERE clause.
It may also help to declare the 2 parameters if they are numbers or dates
(Parameters on Query menu, in query design view.)

<pm********@gmail.comwrote in message
news:11**********************@t46g2000cwa.googleg roups.com...
Hi, I posted this a while ago, and I though I got a solution. I added
referencial intergrity between the tables "tblJobs" and
tblJobsLineItems" as was suggested. The time went to .5 seconds.
Great. Unfortunately, the speed only lasted while I was the only user.
As soon as someone else logs in, it goes in the tank.

The old post is listed below.

I have an append query that needs to run every time a line item is
added to a subform. The append writes to a table that is the source
for a pull down box. Problem is that it takes 5 seconds to run. This
makes adding lines to an order too slow for the users. The result of
the query provides real time availabilty, so I really do need this to
work.

The tblJobs has only 10,000 records, tblJobsLineItems has 150,000
records.

INSERT INTO tmpRaItemsInUseTotals ( [Item Number], SumOfQuantity )
SELECT DISTINCTROW tblJobsLineItems.[Item Number],
Sum(tblJobsLineItems.Quantity) AS SumOfQuantity
FROM tblJobs INNER JOIN tblJobsLineItems ON tblJobs.Job_Num =
tblJobsLineItems.Job_Num
WHERE (((tblJobs.Confirmed)<>"no") AND ((tblJobs.SetCall) Between
[Forms]![frmJobs]![SetCall] And [Forms]![frmJobs]![fldRTSCall])) OR
(((tblJobs.Confirmed)<>"no") AND ((tblJobs.fldRTSCall) Between
[Forms]![frmJobs]![SetCall] And [Forms]![frmJobs]![fldRTSCall])) OR
(((tblJobs.Confirmed)<>"no") AND
((tblJobs.SetCall)<[Forms]![frmJobs]![SetCall]) AND
((tblJobs.fldRTSCall)>[Forms]![frmJobs]![fldRTSCall]))
GROUP BY tblJobsLineItems.[Item Number];

Any ideas?
Dec 28 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: MARTIN DAVIES | last post by:
I hope you can help. My Linux MYSQL 3.23.52 database server is working OK generally. However, in a database I have a field name that ends with a # (hash UK as opposed to £ which is a pound UK)...
4
by: Johnny | last post by:
I have a page with a button that has the following link: <a href="/somelink?org.apache.struts.taglib.html.TOKEN=ef9f9f5973be37ffe39c60227f402770#" onclick="javascript:go( event, 'myForm');return...
14
by: robert4 | last post by:
I cannot get Netscape (7.1) to use my stylesheet. The sheet works with IE and Opera and when I preview using the HomeSite editor, but I cannot get Netscape to see it. I even tried using an...
4
by: Ryan Liu | last post by:
How to loop though controls on the form? I set each control's TabStop and TabIndex, but at run time, I press Tab key, it jump though first control to last control and does not go back to the...
7
by: | last post by:
Hi to everyone! I have an Apache Webserver running on Win2000. I try to start a console application an the server though PHP, with the functions exec() or passthru() but it doesn't work. The...
18
by: bsruth | last post by:
I tried for an hour to find some reference to concrete information on why this particular inheritance implementation is a bad idea, but couldn't. So I'm sorry if this has been answered before....
2
by: wajih.boukaram | last post by:
Hi I've been using asp.net for a couple of days now and i think I've gotten the hang of things I do have a problem when using HttpWebRequest: i request a page from a remote server and this...
3
by: Trevor2007 | last post by:
I am having trouble declairing a variable so that I call get it's value in one event but then call to that variable to retrieve the value in other events (all on the same form. The variable I am...
0
by: service0086 | last post by:
Calvin Klein undergarments have a prominent presence on its website. This brand is quite popular among modern men. They are made from finest and softest fabrics to give that comfort you desire for....
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.