Re: Very slow query
From: Tibor Karaszi (tibor_please.no.email_karaszi_at_hotmail.nomail.com)
Date: 10/19/04
- Next message: Steve: "Re: Very slow query"
- Previous message: Steve: "Re: SQL View Automation"
- In reply to: Steve: "Re: Very slow query"
- Next in thread: Steve: "Re: Very slow query"
- Reply: Steve: "Re: Very slow query"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 19 Oct 2004 17:47:52 +0200
The very first thing to do is consider what indexes you have on the table. Indexing is a huge topic,
with lots if information in Books Online, Books, Courses, the Net etc. But for this particular
situation, a COUNT(*) will benefit very much from a nonclustered index on any column, preferable a
small column (like int etc).
While testing the query in QA, use the "Show Estimated Query Plan" feature. It will show how the
query will be executed.
This is what I suggest you also pick up using Profiler. Profiler is a tracing tool, and you find it
in the SQL Server program group. It is also useful to, for instance, catch the actual SQL
statements. Sometime, your API (ADO in your case) as doing funny things for you...
-- Tibor Karaszi, SQL Server MVP http://www.karaszi.com/sqlserver/default.asp http://www.solidqualitylearning.com/ "Steve" <sedmyer@indy.rr.com> wrote in message news:Sdadd.106317$V06.10636@fe2.columbus.rr.com... > Tibor, > > I am a VB programmer and have little experience with SQL Server (from a DBA perspective). > > First I think that the time taken by QA to run this query is way to long and would like to know if > I am doing something wrong or if there is something that can be done to the DB to improve. > > Second how do I start and use this Profiler? > > Thanks > Steve > > "Tibor Karaszi" <tibor_please.no.email_karaszi@hotmail.nomail.com> wrote in message > news:uxCDi6etEHA.2624@TK2MSFTNGP11.phx.gbl... >>I would start using Profiler to see if the two has the same execution plan. >> >> -- >> Tibor Karaszi, SQL Server MVP >> http://www.karaszi.com/sqlserver/default.asp >> http://www.solidqualitylearning.com/ >> >> >> "Steve" <sedmyer@indy.rr.com> wrote in message news:TA9dd.3580$Dl.236@fe1.columbus.rr.com... >>> Any ideas as to why a simple query (SELECT COUNT(*) FROM Table) on a table with 1,900,000 rows >>> would take 3 minutes to run in Query Analyzer and more than 10 minutes to run from a VB 6 app >>> using ADO? >>> >> >> > >
- Next message: Steve: "Re: Very slow query"
- Previous message: Steve: "Re: SQL View Automation"
- In reply to: Steve: "Re: Very slow query"
- Next in thread: Steve: "Re: Very slow query"
- Reply: Steve: "Re: Very slow query"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|