Field duration in Sql profiler

Bgestel
Member Posts: 136
Hi sql guys and gals,
i'm stil profiling and have a little questing
is a query that takes a long time, which i find strange. SQL is only going for 1 record , the first , isn't it?
So my question is , does the duration of a query include the wait time for a lock ?
i'm stil profiling and have a little questing
SELECT TOP 1 * FROM "SSC W1500SP0 SI1170 Performance Test"."dbo"."Performance Test Company$G_L Entry" WITH (UPDLOCK, ROWLOCK) ORDER BY "Entry No_" DESC
is a query that takes a long time, which i find strange. SQL is only going for 1 record , the first , isn't it?
So my question is , does the duration of a query include the wait time for a lock ?
**********************
** SI ** Bert Van Gestel **
**********************
** SI ** Bert Van Gestel **
**********************
0
Comments
-
Could be. "Duration" gives the time the SQL Server spent to process the query. "CPU" give the time spent on the processors.
Normally "Duration" and "CPU" are quite the same (+-); so if your "CPU" time is remarkably shorter than "Duration" this basically indicates a block ...
But you should also look at the "Reads". With standard NAV - Entry No. = PK & CI - the query should be executed as a "Clustered Index Seek" which should take just a few "Reads" (depending on the number of records, but less than 100 anyway).
If you have too many "Reads" this would also indicate an Indexing problem ...
P.S.: This query is caused by this algorithm, which you could find e.g. in CU 80:GLEntry.LOCKTABLE; GLEntry.FINDLAST;
It's getting the first record of the table in descending order.
And you have the "Always Rowlock" feature enable, which IMHO you shouldn't ...Jörg A. Stryk (MVP - Dynamics NAV)
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool0 -
Are you running this query on SQL 2000 or 2005? There is a bug in SQL 2000 when you look at a clustered index in reverse order it would do a complete and VERY costly clustered index scan to find the record(Entry No. is the clustered index on GL Entry and by default it is in ASC order not DESC) If I remeber correctly it was fixed in SP4 for SQL 2000.
This issue does not exist in SQL 2005, and to answer your question "Yes, the wait time is included in the Duration calculation of the query"0 -
Nobody wrote:... it would do a complete and VERY costly clustered index scan to find the record...
And the first "indicator" to see this behaviour would be the "Reads" in the Profiler. Normally you should have mostly values less than 100. If a Clustered Index Scan on "G/L Entry" is performed, then you will have thousands of "Reads" ...Jörg A. Stryk (MVP - Dynamics NAV)
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions