473,387 Members | 1,502 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.

Query Retrieval is slow

Hi,

I am using MS Access as the front end and it's using ODBC link to connect
to the backend tables residing at SQL SERVER.

I have some queries that are doing some calculation and the time taken to
retrieve the data has been quite slow.

The no of data in that table is around 500K records. and the tables have
already got the PKs defined.

How can i improve the performance of the query besides converting to SQL
Views or SP(this is going to be diffcult as i am getting some filter
parameters from the forms in MS Access) ?

Or what further checks shld i be doing to find out the cause. I have done
Performance Monitor and the CPU processing% is around 20 - 55% while running
those queries

kindly advise

tks & rdgs

--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums...neral/200511/1
Nov 23 '05 #1
9 2017
>How can i improve the performance of the query besides converting to SQL
Views or SP(this is going to be diffcult as i am getting some filter
parameters from the forms in MS Access) ?


You can post your query so we know what you are trying to do.

Nov 23 '05 #2
Hi ,
here's the query :

"INSERT INTO tb_temp ( Stock_Code, Supp_Code, Customer_code, [Group],
Obsolete ) " _
& "SELECT tb_StockCons.Stock_Code, tb_StockInfo.Supp_Code,
tb_StockCons.Customer_code, tb_StockCons.Group, tb_StockCons.Obsolete " _
& "FROM tb_StockInfo INNER JOIN tb_StockCons ON tb_StockInfo.
Stock_Code = tb_StockCons.Stock_Code AND tb_StockInfo.Cty = tb_StockCons.Cty"
_
& "WHERE (((tb_StockCons.Customer_code)=IIf([Forms]!
[frm_Consignment_Rep_Cust]![txtCustomer] Is Null,[tb_StockCons]!
[Customer_code],[Forms]![frm_Consignment_Rep_Cust]![txtCustomer])) AND
(tb_StockCons.Year between " & CheckDate([Forms]![frm_Report]![FromDate]) & "
AND " & CheckDate([Forms]![frm_Report]![ToDate]) & ") AND((tb_StockCons.
Obsolete)=IIf([Forms]![frm_Consignment_Rep_Cust]![txtObsolete] Is Null,
[tb_StockCons]![Obsolete],[Forms]![frm_Consignment_Rep_Cust]![txtObsolete]))
AND ((tb_StockInfo.Sub_Service_Category)='Product') AND ((tb_StockInfo.
Category)=IIf([Forms]![frm_Consignment_Rep_Cust]![txtCategory] Is Null,
[tb_StockInfo]![Category],[Forms]![frm_Consignment_Rep_Cust]![txtCategory])))
AND ((((tb_StockCons.Quantity" & GetPeriodRep() - 1 & ")<>0) OR (
(tb_StockCons.Amount" & GetPeriodRep() - 1 & ")<>0)));"

where GetPeriodMod & CheckDate are functions in MS Access

appreciate ur advice

tks & rdgs
ZeldorBlat wrote:
How can i improve the performance of the query besides converting to SQL
Views or SP(this is going to be diffcult as i am getting some filter
parameters from the forms in MS Access) ?


You can post your query so we know what you are trying to do.


--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums...neral/200511/1
Nov 23 '05 #3
What can be done here is to ask your system dba whether the statistics
on the tables that the query uses is updated recently. In case they are
not, ask the dba to
enable the statistics and create a job the will update statistics on a
weekend when the server is not too busy.

Another option is to use a query analyzer and see what the query plan
is like. If the plan indicates that it is using a table scan, ask have
the dba create relevant index on a table and update and set statistics
on.
On a side note, Access connection to Sql Server that you have is fairly
easy to set up however the TABLE LINKING" method is the slowest as it
hauls not just relevant records but a page amount of record at a time.

If you can do your insert using Connection in the ADO in your forms, it
would be the guaranteed fastest method without any doubt. This is
because you will bypass the virtual table in Access, and will be using
sql server indexes automatically and server processor.

Nov 24 '05 #4
What can be done here is to ask your system dba whether the statistics
on the tables that the query uses is updated recently. In case they are
not, ask the dba to
enable the statistics and create a job the will update statistics on a
weekend when the server is not too busy.

Another option is to use a query analyzer and see what the query plan
is like. If the plan indicates that it is using a table scan, ask have
the dba create relevant index on a table and update and set statistics
on.
On a side note, Access connection to Sql Server that you have is fairly
easy to set up however the TABLE LINKING" method is the slowest as it
hauls not just relevant records but a page amount of record at a time.

If you can do your insert using Connection in the ADO in your forms, it
would be the guaranteed fastest method without any doubt. This is
because you will bypass the virtual table in Access, and will be using
sql server indexes automatically and server processor.

Nov 24 '05 #5
What can be done here is to ask your system dba whether the statistics
on the tables that the query uses is updated recently. In case they are
not, ask the dba to
enable the statistics and create a job the will update statistics on a
weekend when the server is not too busy.

Another option is to use a query analyzer and see what the query plan
is like. If the plan indicates that it is using a table scan, ask have
the dba create relevant index on a table and update and set statistics
on.
On a side note, Access connection to Sql Server that you have is fairly
easy to set up however the TABLE LINKING" method is the slowest as it
hauls not just relevant records but a page amount of record at a time.

If you can do your insert using Connection in the ADO in your forms, it
would be the guaranteed fastest method without any doubt. This is
because you will bypass the virtual table in Access, and will be using
sql server indexes automatically and server processor.

Nov 24 '05 #6
Hi ,
I have checked using sp_statistics 'tablename' and found that there's no
columns being declared with statistics .

How does having a statistical column(s) help to improve performance ? i
would have thought that having clustered/non-clustered index is able to
improve query performance ?

tks & rdgs

VIPS wrote:
What can be done here is to ask your system dba whether the statistics
on the tables that the query uses is updated recently. In case they are
not, ask the dba to
enable the statistics and create a job the will update statistics on a
weekend when the server is not too busy.

Another option is to use a query analyzer and see what the query plan
is like. If the plan indicates that it is using a table scan, ask have
the dba create relevant index on a table and update and set statistics
on.

On a side note, Access connection to Sql Server that you have is fairly
easy to set up however the TABLE LINKING" method is the slowest as it
hauls not just relevant records but a page amount of record at a time.

If you can do your insert using Connection in the ADO in your forms, it
would be the guaranteed fastest method without any doubt. This is
because you will bypass the virtual table in Access, and will be using
sql server indexes automatically and server processor.


--
Message posted via http://www.sqlmonster.com
Nov 25 '05 #7
Hi ,

kindly ignore this as i found what i wanted from the BOL. I have just
found out that the query itself is quite fast after tracing thru the codes.
This query insert data into a temp table. The problem happens when the report
from MS Access is formatting the data not only from the temp table but also
SQL table.

How is it possible to create a ADO connection that can be used by ms access
report instead on relying on the odbc-linked table ?

tks & rdgs
maxzsim wrote:
Hi ,
I have checked using sp_statistics 'tablename' and found that there's no
columns being declared with statistics .

How does having a statistical column(s) help to improve performance ? i
would have thought that having clustered/non-clustered index is able to
improve query performance ?

tks & rdgs
What can be done here is to ask your system dba whether the statistics
on the tables that the query uses is updated recently. In case they are

[quoted text clipped - 15 lines]
because you will bypass the virtual table in Access, and will be using
sql server indexes automatically and server processor.


--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums...neral/200511/1
Nov 25 '05 #8
maxzsim via SQLMonster.com (u14644@uwe) writes:
kindly ignore this as i found what i wanted from the BOL. I have just
found out that the query itself is quite fast after tracing thru the
codes. This query insert data into a temp table. The problem happens
when the report from MS Access is formatting the data not only from the
temp table but also SQL table.

How is it possible to create a ADO connection that can be used by ms
access report instead on relying on the odbc-linked table ?


Maybe it's time to inquire in an Access newsgroup? At least, I have
nothing to suggest, as I don't know Access.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Nov 26 '05 #9
In Access you can use SQL Passthrough queries.

These pass the raw SQL thriough to the server which processes the request
and returns the results.

--
Terry Kreft

"Erland Sommarskog" <es****@sommarskog.se> wrote in message
news:Xn**********************@127.0.0.1...
maxzsim via SQLMonster.com (u14644@uwe) writes:
kindly ignore this as i found what i wanted from the BOL. I have just
found out that the query itself is quite fast after tracing thru the
codes. This query insert data into a temp table. The problem happens
when the report from MS Access is formatting the data not only from the
temp table but also SQL table.

How is it possible to create a ADO connection that can be used by ms
access report instead on relying on the odbc-linked table ?


Maybe it's time to inquire in an Access newsgroup? At least, I have
nothing to suggest, as I don't know Access.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx

Nov 26 '05 #10

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

Similar topics

6
by: Ryan | last post by:
I came across a situation that I've been unable to explain and was hoping somebody had an answer: I had written an update query which was taking about 8 seconds to run and considered it too...
5
by: WindAndWaves | last post by:
For some reason i have this dodgy query in my database: ~sq_fM-WEB-SUB It does not do anything, but I can NOT - open it - delete it - rename it etc... because according to access, I do not...
15
by: Rolan | last post by:
There must be a way to enhance the performance of a query, or find a plausible workaround, but I seem to be hitting a wall. I have tried a few tweaks, however, there has been no improvement. ...
6
by: Sparticus | last post by:
I have a database that isn't very big. It has about 2400 rows in it. I try and do an update like this one below (it looks big, but it's really not if you look at it) : UPDATE jobs SET...
3
by: serge | last post by:
How do I determine which method I should use if I want to optimize the performance of a database. I took Northwind's database to run my example. My query is I want to retrieve the Employees'...
2
by: Bob | last post by:
I am developing an ASP.NET application that needs to archive documents and support the retrieval of them. When the document is stored, the user needs to be able to indicate whether it is a public...
4
by: Hemant Shah | last post by:
Folks, I am having problem with an application that uses static SQL, the application basically browses through the table given start and end key most of the time it is processed from begining to...
12
by: grace | last post by:
i am wondering why my database retrieval becomes too slow...we set up a new server (ubuntu, breezy badger) machine where we transferred all our files from the old server.. Our new server uses Asus...
0
by: zonar00 | last post by:
I wanna help on the following aspect of SQL data retrieval which requires one to retrieve data from remote SQL server site asynchronously. Im building a c# application. I want to retrieve record...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
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...

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.