Home All Groups Group Topic Archive Search About

Profiler and cursors

Author
5 Dec 2005 7:43 PM
DavidCur
Hi,

I've been asked to track how many times a number of tables get selected
from, as a baseline for some application caching development going on. 

I thought this would be easy enough, as they don't need exact numbers, just
to be able to rank the tables in order of use (e.g. which tables get used the
most, as apposed to those that hardly get queried at all).

So I set up a standard trace, filtering the textdata column for any text
containing the names of the specified tables.  This environment doesn't make
use of stored procs, so I wasn't worried about SPs. 

However, it does make extensive use of server-side cursors.  Which is
causing a problem in that I'm not getting any hits for the list of tables. 
If I manually select from a few tables, I capture my activity, but from the
application I only seem to be capturing sp_execute's and sp_cursorclose's. 
So I'm unable to get how many times each table is hit, because the SQL is
pre-prepared, so I can't see the table name in the textdata.

Is there any data/column/etc that I can add to my trace to capture these
pre-prepared statements?  If not, does anyone know of any other way I could
achieve the same result?

Many thanks,
Dave

Author
5 Dec 2005 9:35 PM
Tibor Karaszi
Not sure how well it will work for that particular scenario, but I'd try capturing and filtering in
the execution plan.

Show quote
"DavidCur" <cdf_nospam_@webmail.co.za> wrote in message
news:63CCA49D-4402-4C80-BA57-CAF5CDE4F337@microsoft.com...
> Hi,
>
> I've been asked to track how many times a number of tables get selected
> from, as a baseline for some application caching development going on.
>
> I thought this would be easy enough, as they don't need exact numbers, just
> to be able to rank the tables in order of use (e.g. which tables get used the
> most, as apposed to those that hardly get queried at all).
>
> So I set up a standard trace, filtering the textdata column for any text
> containing the names of the specified tables.  This environment doesn't make
> use of stored procs, so I wasn't worried about SPs.
>
> However, it does make extensive use of server-side cursors.  Which is
> causing a problem in that I'm not getting any hits for the list of tables.
> If I manually select from a few tables, I capture my activity, but from the
> application I only seem to be capturing sp_execute's and sp_cursorclose's.
> So I'm unable to get how many times each table is hit, because the SQL is
> pre-prepared, so I can't see the table name in the textdata.
>
> Is there any data/column/etc that I can add to my trace to capture these
> pre-prepared statements?  If not, does anyone know of any other way I could
> achieve the same result?
>
> Many thanks,
> Dave
Author
5 Dec 2005 9:53 PM
DavidCur
Thanks, I'll give that a go.

Dave


Show quote
"Tibor Karaszi" wrote:

> Not sure how well it will work for that particular scenario, but I'd try capturing and filtering in
> the execution plan.
>
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/

AddThis Social Bookmark Button