473,480 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Suggestions to resolve slow query

I need to have a form which will display all products (from
tblproducts) and their stock level (sum of product received from
tblacqdetail, minus sum of product sold from tblinvdetail) in a
listbox. The form should only display those records whose product code
contains the characters typed in a text box on the form.

At the moment I do this by using the on change event of the text box
and refreshing the listbox.

The queries are a subquery to get stock level and then main query which
contains the criteria : - "like *mytextfield*"

This works as it should but takes forever to load and to use,
particularly as the on change coding refreshes the list box on each
keypress!

Can anyone suggest either a way to speed up the existing method or
point me in the right direction of an alternative.

Thanks

Aug 12 '06 #1
2 1679
Sheesh, David, you are asking Access to perform a series of calculations
involving rows of data from multiple tables, using wildcard matching,
between keystrokes?

Suggestions:

1. Would you consider using the AfterUpdate event of the search box so it
does not have to recalculate with every keystroke?

2. Could you live with just the trailing wildcard in the criteria, i.e.:
Like [mytextfield] & "*"
That will permit JET to use an index on the field.
Of course, this presumes that:
a) the criteria is applied against a field of type Text, and
b) the field is indexed.

3. How are the calculations performed? In general:
- Subqueries will be fastest.
- Built-in functions are second best.
- User-defined function are third best.
- Domain-aggregate functions are slowest.

4. There may be other ways to optimise this, such as:
- stacked queries
- temp tables

--
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.

"David Mitchell" <da**************@talk21.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
>I need to have a form which will display all products (from
tblproducts) and their stock level (sum of product received from
tblacqdetail, minus sum of product sold from tblinvdetail) in a
listbox. The form should only display those records whose product code
contains the characters typed in a text box on the form.

At the moment I do this by using the on change event of the text box
and refreshing the listbox.

The queries are a subquery to get stock level and then main query which
contains the criteria : - "like *mytextfield*"

This works as it should but takes forever to load and to use,
particularly as the on change coding refreshes the list box on each
keypress!

Can anyone suggest either a way to speed up the existing method or
point me in the right direction of an alternative.

Thanks

Aug 13 '06 #2
Thanks for responding Allen. Your site has been a great help to me in
this (and previous) project(s). I did realise that I was asking a lot
of Access but my boss wanted it to work this way. It has a lot to do
with the system that is being replaced, it used stored stock values and
was much faster (although you needed to know exactly what the stock
code was - hence the "like * mytextfield*")

The criteria field is text based and I could live with myfield & "*"
I'll need to check whether or not it is indexed. The after update
would probably be okay bearing in mind this is still a major
improvement on the old system.

I'll try both of these on Tuesday when I am back in the office and let
you know how it goes.

David

Aug 13 '06 #3

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

Similar topics

2
5335
by: Tim Fountain | last post by:
We've recently enabled slow query logging on a server and it's proving interesting seeing which queries are bogging things down. This one is puzzling me a little: SELECT articleid, type,...
0
1286
by: Matt W | last post by:
Hi all, I'm planning to use MySQL's full-text search for my forum system (possibly 5+ million posts). I've been playing with it a lot lately to see the performance and functionality and have...
0
915
by: User | last post by:
Hi, I am writing a program in VB.NET and it is very slow when it reach this line : .... Dim ipHostInfo As IPHostEntry = Dns.Resolve(strMyForeignIP) ....
1
402
by: User | last post by:
Hi, I am writing a program in VB.NET and it is very slow when it reach this line : Dim ipHostInfo As IPHostEntry = Dns.Resolve(strMyForeignIP) It stay there at least 5 seconds to reach the...
2
1996
by: Yonatan Goraly | last post by:
I am in the process of adding PostgreSQL support for an application, in addition to Oracle and MS SQL. I am using PostgreSQL version 7.3.2, Red Hat 9.0 on Intel Pentium III board. I have a...
3
4777
by: Janross | last post by:
I'm having trouble with a query that's prohibitively slow. On my free-standing office computer it's fine (well, 2-4 seconds), but on the client's network, it takes at least 5 minutes to run. ...
193
9361
by: Michael B. | last post by:
I was just thinking about this, specifically wondering if there's any features that the C specification currently lacks, and which may be included in some future standardization. Of course, I...
0
2660
by: Dave Hammond | last post by:
Hi All, I'm trying to use the slow-query-log (with --log-queries-not-using-indexes enabled) to determine if any queries need optimization, and have a few questions about some entries I'm...
2
9808
by: existential.philosophy | last post by:
This is a new problem for me: I have some queries that open very slowly in design view. My benchmark query takes about 20 minutes to open in design view. That same query takes about 20 minutes...
0
6908
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...
1
6737
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
6921
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
5336
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,...
1
4776
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...
0
4481
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2995
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2984
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.