473,387 Members | 1,483 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,387 software developers and data experts.

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 2736
ph*****@hotmail.com (phobos) wrote in news:af26c87a.0402160657.78407d21
@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*****@hotmail.com> wrote in message
news:af**************************@posting.google.c om...
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.OrderTotal 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*******************@130.133.1.4>...
ph*****@hotmail.com (phobos) wrote in news:af26c87a.0402160657.78407d21
@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.0402160657.78407d21
@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*****@hotmail.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
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...
3
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...
4
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...
2
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...
1
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...
1
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
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...
1
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...
2
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...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
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...

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.