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

Access Query on SQL Linked Tables

Hey everybody, got a secnario for ya that I need a bit of help with.

Access 97 using linked tables from an SQL Server 2000 machine.

I've created a simple query using two tables joined by one field
between them. The join field in both tables are indexed and I'm
selecting 1 field from each table to lookup. The Access query is
taking more than 60 second to retrieve 1 record and if I execute the
same query within the Query Analyzer, it takes less than a second to
execute.

I've tried using the SQL Profiler to see what's being sent to the
server, but I don't see anything showing up there when I execute the
Access query. I must confess that I'm new to the Profiler, so I might
not be looking in the correct place for the SQL that is supposedly
being processed.

Do you think that Jet is retrieving all of the records from the SQL
machine so that it can run the query locally? If so, is there a way
for me to see this activitiy within the SQL Profiler?

Thanks for any insight you can provide,
Jim
Jun 27 '08 #1
6 4346
On Apr 16, 9:49 am, jsac...@comcast.net wrote:
Hey everybody, got a secnario for ya that I need a bit of help with.

Access 97 using linked tables from an SQL Server 2000 machine.

I've created a simple query using two tables joined by one field
between them. The join field in both tables are indexed and I'm
selecting 1 field from each table to lookup. The Access query is
taking more than 60 second to retrieve 1 record and if I execute the
same query within the Query Analyzer, it takes less than a second to
execute.

I've tried using the SQL Profiler to see what's being sent to the
server, but I don't see anything showing up there when I execute the
Access query. I must confess that I'm new to the Profiler, so I might
not be looking in the correct place for the SQL that is supposedly
being processed.

Do you think that Jet is retrieving all of the records from the SQL
machine so that it can run the query locally? If so, is there a way
for me to see this activitiy within the SQL Profiler?

Thanks for any insight you can provide,
Jim
Is this a pass-through query? If not, it sounds like it probably
should be. If you are not familiar with pass-through queries, look
them up in help. They basically pass the query processing to SQL
server rather than letting Jet handle them locally. It's a fairly
simple matter (for simple queries) to convert to pass-through. In SQL
view, select Query, SQL Specific, then Pass-through on the menu.

Bruce
Jun 27 '08 #2
On Apr 16, 3:42*pm, Bruce <deluxeinformat...@gmail.comwrote:
On Apr 16, 9:49 am, jsac...@comcast.net wrote:


Hey everybody, got a secnario for ya that I need a bit of help with.
Access 97 using linked tables from an SQL Server 2000 machine.
I've created a simple query using two tables joined by one field
between them. *The join field in both tables are indexed and I'm
selecting 1 field from each table to lookup. *The Access query is
taking more than 60 second to retrieve 1 record and if I execute the
same query within the Query Analyzer, it takes less than a second to
execute.
I've tried using the SQL Profiler to see what's being sent to the
server, but I don't see anything showing up there when I execute the
Access query. *I must confess that I'm new to the Profiler, so I might
not be looking in the correct place for the SQL that is supposedly
being processed.
Do you think that Jet is retrieving all of the records from the SQL
machine so that it can run the query locally? *If so, is there a way
for me to see this activitiy within the SQL Profiler?
Thanks for any insight you can provide,
Jim

Is this a pass-through query? *If not, it sounds like it probably
should be. *If you are not familiar with pass-through queries, look
them up in help. *They basically pass the query processing to SQL
server rather than letting Jet handle them locally. *It's a fairly
simple matter (for simple queries) to convert to pass-through. *In SQL
view, select Query, SQL Specific, then Pass-through on the menu.

Bruce- Hide quoted text -

- Show quoted text -
No, it's not a PassThru....it was a query that a user designed with a
simple join in it. I've pretty much cured the problem by packaging
the SQL in a stored procedure with parameters and calling it with a
passthru call now. This is an old Access 97 app that has been in
place for some time now. The tables that this app is looking at have
grown over the years and we're starting to see degradation in
performance with some of the Jet queries on linked tables.

I have a workaround, but would like to know if Access is dragging all
of those records across the network just to do the join in design
mode. Found out yesterday after posting my question that it takes
forever to just open the query in design mode also.
Jun 27 '08 #3
On Apr 17, 8:31 am, jsac...@comcast.net wrote:
On Apr 16, 3:42 pm, Bruce <deluxeinformat...@gmail.comwrote:
On Apr 16, 9:49 am, jsac...@comcast.net wrote:
Hey everybody, got a secnario for ya that I need a bit of help with.
Access 97 using linked tables from an SQL Server 2000 machine.
I've created a simple query using two tables joined by one field
between them. The join field in both tables are indexed and I'm
selecting 1 field from each table to lookup. The Access query is
taking more than 60 second to retrieve 1 record and if I execute the
same query within the Query Analyzer, it takes less than a second to
execute.
I've tried using the SQL Profiler to see what's being sent to the
server, but I don't see anything showing up there when I execute the
Access query. I must confess that I'm new to the Profiler, so I might
not be looking in the correct place for the SQL that is supposedly
being processed.
Do you think that Jet is retrieving all of the records from the SQL
machine so that it can run the query locally? If so, is there a way
for me to see this activitiy within the SQL Profiler?
Thanks for any insight you can provide,
Jim
Is this a pass-through query? If not, it sounds like it probably
should be. If you are not familiar with pass-through queries, look
them up in help. They basically pass the query processing to SQL
server rather than letting Jet handle them locally. It's a fairly
simple matter (for simple queries) to convert to pass-through. In SQL
view, select Query, SQL Specific, then Pass-through on the menu.
Bruce- Hide quoted text -
- Show quoted text -

No, it's not a PassThru....it was a query that a user designed with a
simple join in it. I've pretty much cured the problem by packaging
the SQL in a stored procedure with parameters and calling it with a
passthru call now. This is an old Access 97 app that has been in
place for some time now. The tables that this app is looking at have
grown over the years and we're starting to see degradation in
performance with some of the Jet queries on linked tables.

I have a workaround, but would like to know if Access is dragging all
of those records across the network just to do the join in design
mode. Found out yesterday after posting my question that it takes
forever to just open the query in design mode also.
It's hard to say whether Access is dragging _all_ of the relevent
records over the wire to produce your query results but it is safe to
say that it is dragging far more stuff over the wire than a
passthrough query will. Without being a passthrough query, Access'
Jet database engine is handling the join and the processing necessary
to return records in your result set. While Jet can certainly
optimize this to some degree based on its knowledge of the indexes and
predefined relationships between the tables it is not as efficient as
letting SQL Server handle all of that processing and simply hand over
the completed result set to Access, which is what a passthrough query
does. It sounds like your original query was a parameterized query
which SQL Server will only handle in the form of a stored procedure,
i.e., you cannot turn a query with replaceable parameters directly
into a passthrough query. I don't know if establishing relationships
and referential integrity rules between the ODBC tables at the Access
level would help (or is even possible) but if so that is something
that might help speed things up for the non-passthrough queries.
Sounds to me like you did just the right thing though, rewriting as a
sproc with parameters.

Bruce
Jun 27 '08 #4
On Apr 17, 10:02*am, Bruce <deluxeinformat...@gmail.comwrote:
On Apr 17, 8:31 am, jsac...@comcast.net wrote:


On Apr 16, 3:42 pm, Bruce <deluxeinformat...@gmail.comwrote:
On Apr 16, 9:49 am, jsac...@comcast.net wrote:
Hey everybody, got a secnario for ya that I need a bit of help with.
Access 97 using linked tables from an SQL Server 2000 machine.
I've created a simple query using two tables joined by one field
between them. *The join field in both tables are indexed and I'm
selecting 1 field from each table to lookup. *The Access query is
taking more than 60 second to retrieve 1 record and if I execute the
same query within the Query Analyzer, it takes less than a second to
execute.
I've tried using the SQL Profiler to see what's being sent to the
server, but I don't see anything showing up there when I execute the
Access query. *I must confess that I'm new to the Profiler, so I might
not be looking in the correct place for the SQL that is supposedly
being processed.
Do you think that Jet is retrieving all of the records from the SQL
machine so that it can run the query locally? *If so, is there a way
for me to see this activitiy within the SQL Profiler?
Thanks for any insight you can provide,
Jim
Is this a pass-through query? *If not, it sounds like it probably
should be. *If you are not familiar with pass-through queries, look
them up in help. *They basically pass the query processing to SQL
server rather than letting Jet handle them locally. *It's a fairly
simple matter (for simple queries) to convert to pass-through. *In SQL
view, select Query, SQL Specific, then Pass-through on the menu.
Bruce- Hide quoted text -
- Show quoted text -
No, it's not a PassThru....it was a query that a user designed with a
simple join in it. *I've pretty much cured the problem by packaging
the SQL in a stored procedure with parameters and calling it with a
passthru call now. *This is an old Access 97 app that has been in
place for some time now. *The tables that this app is looking at have
grown over the years and we're starting to see degradation in
performance with some of the Jet queries on linked tables.
I have a workaround, but would like to know if Access is dragging all
of those records across the network just to do the join in design
mode. *Found out yesterday after posting my question that it takes
forever to just open the query in design mode also.

It's hard to say whether Access is dragging _all_ of the relevent
records over the wire to produce your query results but it is safe to
say that it is dragging far more stuff over the wire than a
passthrough query will. *Without being a passthrough query, Access'
Jet database engine is handling the join and the processing necessary
to return records in your result set. *While Jet can certainly
optimize this to some degree based on its knowledge of the indexes and
predefined relationships between the tables it is not as efficient as
letting SQL Server handle all of that processing and simply hand over
the completed result set to Access, which is what a passthrough query
does. *It sounds like your original query was a parameterized query
which SQL Server will only handle in the form of a stored procedure,
i.e., you cannot turn a query with replaceable parameters directly
into a passthrough query. *I don't know if establishing relationships
and referential integrity rules between the ODBC tables at the Access
level would help (or is even possible) but if so that is something
that might help speed things up for the non-passthrough queries.
Sounds to me like you did just the right thing though, rewriting as a
sproc with parameters.

Bruce- Hide quoted text -

- Show quoted text -
Thanks for the insight Bruce! I know that the thing to do would be to
rewrite the whole app with an ADP and sprocs everywhere, but I'm a one-
man shop and this is one of our production systems for auditing
electronic records. Like everybody else, I have so much on my plate
at this point, it's hard to do that much coding with everything else
going on.

Take it easy,
Jim
Jun 27 '08 #5
js*****@comcast.net wrote in news:632ae324-05f3-4962-b17d-
af**********@m44g2000hsc.googlegroups.com:
Hey everybody, got a secnario for ya that I need a bit of help with.

Access 97 using linked tables from an SQL Server 2000 machine.

I've created a simple query using two tables joined by one field
between them. The join field in both tables are indexed and I'm
selecting 1 field from each table to lookup. The Access query is
taking more than 60 second to retrieve 1 record and if I execute the
same query within the Query Analyzer, it takes less than a second to
execute.

I've tried using the SQL Profiler to see what's being sent to the
server, but I don't see anything showing up there when I execute the
Access query. I must confess that I'm new to the Profiler, so I might
not be looking in the correct place for the SQL that is supposedly
being processed.

Do you think that Jet is retrieving all of the records from the SQL
machine so that it can run the query locally? If so, is there a way
for me to see this activitiy within the SQL Profiler?

Thanks for any insight you can provide,
Jim
What are you using the query for?

Can you post the SQL string?
Jun 27 '08 #6
js*****@comcast.net wrote:
No, it's not a PassThru....it was a query that a user designed with a
simple join in it. I've pretty much cured the problem by packaging
the SQL in a stored procedure with parameters and calling it with a
passthru call now. This is an old Access 97 app that has been in
place for some time now. The tables that this app is looking at have
grown over the years and we're starting to see degradation in
performance with some of the Jet queries on linked tables.

I have a workaround, but would like to know if Access is dragging all
of those records across the network just to do the join in design
mode. Found out yesterday after posting my question that it takes
forever to just open the query in design mode also.
You could use SQL tracing tools to see what exactly is being passed to the
server. Here is an example if what I have seen using SQL Trace when joining
two ODBC linked tables in Access.

Table1:
Field foo
Field bar

Table2:
Field bar

Access query joining on bar with a WHERE clause on foo.

Access pulls all desired fields from Table1 for rows where foo satisfies the
WHERE clause and then sends SQL to server for Table2 for rows where bar is
equal to...

first value of bar from Table1
OR next value of bar from Table1
OR next value of bar from Table1
etc...

So the query still has quite a bit of processing done by the server, but the
actual JOIN is not performed by the server. Rather it is replaced with a
whole bunch of OR criteria to match up Table2 bar to the values in Table1
bar.

Examining this you can see that if the number of rows in Table1 that
satisify the WHERE clause is small then the query can execute pretty
quickly. One would very much expect performance to fall off though as the
number of rows returned from Table1 increases.

So as I examine "standard Access queries" that use ODBC linked tables to see
which ones ought to be changed into Passthroughs or Stored Procedures I
first look at those that already perform slower than I would like. The next
group to look at then are those that have joins between one or more of the
linked tables.

And there is no speed advantage to moving everything into an Access project.
You can certainly go that route, but a Passthrough or Stored Procedure
executed via a Passthrough will perform just as well.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Jun 27 '08 #7

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

Similar topics

3
by: Jon Ole Hedne | last post by:
My Access 2002-application need to work with tables from both Oracle and Access. To solve this, I want to run some querys on three views in Oracle and import the results into temporary...
3
by: dk | last post by:
Hi all, Would appreciate some advice on the following: I am trying to speed up an Access database connected to a SQL Server back-end. I know I can use a pass-through query to pass the sql...
8
by: Alfonso Esteban Gonzalez Sencion | last post by:
I am trying to use Access as a front end for extracting information from an Oracle database. I started using linked tables but I am getting a very curious behaviour. When I consult the linked...
15
by: brettclare | last post by:
I have linked a large SQL Server table to Access, however 'only' 2,195,439 records are shown and are available to query. Can I increase the size (cache??)/number of records showing in Access? ...
6
by: fumanchu | last post by:
I've got to let end users (really just one person) load billing batch files into a third party app table. They need to specify the billing cycle name, the batch name, and the input file name and...
52
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server...
5
by: jonceramic | last post by:
Hi All, I started developing in Access, and people took notice and so we're starting to migrate into our corporate's bigger Oracle system. I'll still be using my developed Access front ends,...
3
by: mnjkahn via AccessMonster.com | last post by:
I'm running Access 2003, modifying a query that has over 45 fields. When I right click on the field name in Query Design View, and then click Build, Access crashes before the Build window...
4
by: pokerboy801 | last post by:
OK, I will try to explain this as clearly and as concise as possible. I am using Access, which has three MS Excel Linked tables, to store call center metrics for reps. My Excel workbook has three...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.