Discover origin of SQL statement

In my profile summary report (shown at the bottom of the page), I currently have all SQL statements and times shown.

Is it possible to add another column which shows where the SQL statement originated, so that I can find it and optimize it?

For example, a certain page currently has 40 SQL statements running, and I would like to optimize them. This means I have to go through a ton of code to hunt down the original just to find where/who created this statement.

Would be very useful to add a trace or something to this… or does it exist already?

Thanks for the help!

If you have debugging turned on you should be able to see this already.

Before the begin/end of the profile you’re looking at should be the trace of the same sql statement - at the end of this it should show where it came from.

You should see something along the lines of the following:




in /var/www/ (14)

Thanks, I forgot to enable my CWebLogRoute.