473,569 Members | 2,572 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Filters and sorts in datasheet view

I have a complex query built up out of lots of little queries; I run
the final one and look at the output. This query takes a little while
to run - like maybe a couple of minutes. Lots of calculations about
the place, being done on a few thousand records; this could probably
be improved upon as I learn new tricks.

But I notice that when I add a filter, or I sort the results, it takes
a long time to run - even though all the calculations have already
been done, and all that's being filtered or sorted is a set of a few
hundred rows of four or five columns. Not so computationally
intensive, one would have thought.

Is Access actually appending an ORDER BY or a WHERE clause to the
original query and then recalculating everything from scratch? If so,
_why_? If not, why the big hold-up?
Nov 12 '05 #1
5 2755
ph*****@hotmail .com (phobos) wrote in news:af26c87a.0 402160657.78407 d21
@posting.google .com:
I have a complex query built up out of lots of little queries; I run
the final one and look at the output. This query takes a little while
to run - like maybe a couple of minutes. Lots of calculations about
the place, being done on a few thousand records; this could probably
be improved upon as I learn new tricks.

But I notice that when I add a filter, or I sort the results, it takes
a long time to run - even though all the calculations have already
been done, and all that's being filtered or sorted is a set of a few
hundred rows of four or five columns. Not so computationally
intensive, one would have thought.

Is Access actually appending an ORDER BY or a WHERE clause to the
original query and then recalculating everything from scratch? If so,
_why_? If not, why the big hold-up?


Perhaps you should post the SQL of these queries? Often JET will not optimize
calculated expressions nor sub-queries.

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #2
"phobos" <ph*****@hotmai l.com> wrote in message
news:af******** *************** ***@posting.goo gle.com...
I have a complex query built up out of lots of little queries; I run
the final one and look at the output. This query takes a little while
to run - like maybe a couple of minutes. Lots of calculations about
the place, being done on a few thousand records; this could probably
be improved upon as I learn new tricks.

But I notice that when I add a filter, or I sort the results, it takes
a long time to run - even though all the calculations have already
been done, and all that's being filtered or sorted is a set of a few
hundred rows of four or five columns. Not so computationally
intensive, one would have thought.

Is Access actually appending an ORDER BY or a WHERE clause to the
original query and then recalculating everything from scratch? If so,
_why_? If not, why the big hold-up?


The general approach to relational databases is not to duplicate data That
is if you have tblOrderItems = ItmID, ItmQty, ItmUnitCost, etc, then having
a field tblOrders.Order Total is redundant and should be avoided as it could
lead to contradictory information.
However, there are times and this might be one of them where you create a
table of totals which has indexed fields where you do the sorting /
filtering. So if you analyse yearly sales totals, the table might have
ProductType and FinancialYear as indexed fields so you could quickly find
the summarised data without re-calculating from scratch.


Nov 12 '05 #3
Lyle Fairfield <Mi************ @Invalid.Com> wrote in message news:<Xn******* ************@13 0.133.1.4>...
ph*****@hotmail .com (phobos) wrote in news:af26c87a.0 402160657.78407 d21
@posting.google .com:
I have a complex query built up out of lots of little queries; I run
the final one and look at the output. This query takes a little while
to run - like maybe a couple of minutes. Lots of calculations about
the place, being done on a few thousand records; this could probably
be improved upon as I learn new tricks.

But I notice that when I add a filter, or I sort the results, it takes
a long time to run - even though all the calculations have already
been done, and all that's being filtered or sorted is a set of a few
hundred rows of four or five columns. Not so computationally
intensive, one would have thought.

Is Access actually appending an ORDER BY or a WHERE clause to the
original query and then recalculating everything from scratch? If so,
_why_? If not, why the big hold-up?


Perhaps you should post the SQL of these queries? Often JET will not optimize
calculated expressions nor sub-queries.


I don't think it's them that's the problem. They're slow, sure:
calculated expressions everywhere, which are used as lookups in later
queries on the ones that have gone before - really a hack until I get
a better design sorted out. I'm fairly new at this game, but I'm
getting there...

What puzzles me is that Access seems to rerun the entire thing when I
do something simple like right-click and choose 'Filter by Selection'.
Once it's generated this result, surely it doesn't have to do it all
again just in order to pick out a few rows and eliminate the rest?

Is this what you mean by Jet not optimising them? Because I've joined
on calculated values, for some reason it can't retain the output and
instead has to recalculate the whole lot?
Nov 12 '05 #4
Phobos,
A filter is in essence an addition to the existing SQL statement that
produced the result set which further limits the returned rows or sorts
them. So, yeah, Access has to rerun the SQL to return the requested result
set and that can take time. If you have a complex query built up out of
lots of little queries you might improve things by building temporary tables
with your intermediate results and using the temporary tables in subsequent
steps. Better yet, use VBA to script your process so the end result is a
temporary table with the results. Then you can index the result table and
dramatically reduce the recalculation needed to apply a filter or sort.
ph*****@hotmail .com (phobos) wrote in news:af26c87a.0 402160657.78407 d21
@posting.google .com:
I have a complex query built up out of lots of little queries; I run
the final one and look at the output. This query takes a little while
to run - like maybe a couple of minutes. Lots of calculations about
the place, being done on a few thousand records; this could probably
be improved upon as I learn new tricks.

Nov 12 '05 #5
"Alan Webb" <kn*****@hotmai l.com> wrote in message news:<p1******* **********@news .uswest.net>...
Phobos,
A filter is in essence an addition to the existing SQL statement that
produced the result set which further limits the returned rows or sorts
them. So, yeah, Access has to rerun the SQL to return the requested result
set and that can take time.
I thought it might be. Still seems like an odd design, though. I
suppose it has to be this way to take account of possible updates made
by other users...
If you have a complex query built up out of
lots of little queries you might improve things by building temporary tables
with your intermediate results and using the temporary tables in subsequent
steps.
Interesting idea. In fact, it's probably a very good idea: there are
three separate queries that really just format the output of this
whole structure in different ways for use in reports. Storing the
results of the final stage and then running the output queries on that
store would improve things quite a bit.
Better yet, use VBA to script your process so the end result is a
temporary table with the results. Then you can index the result table and
dramatically reduce the recalculation needed to apply a filter or sort.


Or, I suppose, output the whole recordset to Excel and use that :-)

I mean to start moving a lot of this stuff into VBA anyway... it's
certainly easier to follow what's going on in a good VBA module than
in a collection of cryptically named, uncommented fragments of SQL.
Nov 12 '05 #6

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

Similar topics

3
6411
by: Keith Wilby | last post by:
I have a form which allows both form and datasheet views. My question is, is it possible to control the field (column) names in datasheet view? What happens at the moment is that the name is taken from a control's label if there is one, and if not, the control's name is used. This is confusing for my users so I'd like to be able to use...
3
3556
by: Kent Eilers | last post by:
I want to follow naming conventions for my controls - i usually prefix combo boxes with "cbo". When a form is in datasheet view however i do not want the user to see the 'cbo' prefix in front of the field name. Is there a way to retain this nomenclature and yet have the view display the field name (or anyname i want for that matter)? ...
4
9400
by: Terry | last post by:
I have created a Main Switchboard in Access 2000 and it has a button which opens a Form. I have set the form Properties Default View to Datasheet and this always opens in datasheet view. When I open the Form from the Main Switchboard it always opens in form view. Can this be changed so that it always opens in Datasheet View? Terry
2
3492
by: Georges Heinesch | last post by:
Hi: I have a tables in relationship to each other. When I open the main table (table 1), I see a "+" at the very left of every record. Clicking on the "+" expands the data of the linked table (table 2). Now ... when I create a form from table 1, I didn't manage show these 2 tables the same way (with the "+" at the left side of every...
1
2961
by: Yuki | last post by:
I am trying to find out if I can have a specific record that has been selected in a list box be opened in datasheet view. I can't seem to find where this can happen or what I need to use to make it happen? Does anyone have any ideas? My list box is currently tied to an option group so that they can sort the list box in order of how they want...
1
2826
by: sasan3 | last post by:
when I set visible=false, then entry is not visible in form view, but still shows up in datasheet view. How do I make a field not to show based on some condition in datasheet view? Tx.
6
6243
by: smcdonald | last post by:
I have a report that opens up using a pretty complex query. I then pop up a form with combo boxes so the user can apply a filter to the existing report and then refresh the report. I need to export the report's records with the applied query to excel in datasheet form and it needs to contain the additional filters that the user selects. The...
1
3712
by: fiazbfs | last post by:
I would like to know the Keyboard Shortcuts for "Apply Filter", "Filter by Form", "Filter by Selection" in datasheet / form view. It is very annoying to just be able to use the mouse for this process. Keyboard shortcut will certainly make the work faster. If there are no shortcuts available, how can I create one. Also, I want to make sure...
2
3141
by: Alan Forsyth | last post by:
That rather long subject says it. In Access97 running on XP - I want to display a Maximized size Form01, then open a Restore size Datasheet View Form02 on top of the first Form. PopUp won't give me Datasheet view. Dialog mode won't give me Datasheet view I could make Form01 Restore size and expand it to fill the Window in Restore size...
0
7614
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8125
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7676
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7974
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3653
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.