Yii Framework Forum: Discover origin of SQL statement - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Discover origin of SQL statement from the profile summary report Rate Topic: -----

#1 User is offline   edanb 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 32
  • Joined: 16-June 09

Posted 01 November 2010 - 05:42 AM

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!
0

#2 User is offline   Orteko 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 34
  • Joined: 02-March 10

Posted 01 November 2010 - 06:02 AM

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/somesite.com/htdocs/protected/controllers/SomeController.php
(188)
in /var/www/somesite.com/htdocs/index.php (14)

0

#3 User is offline   edanb 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 32
  • Joined: 16-June 09

Posted 01 November 2010 - 07:16 AM

Thanks, I forgot to enable my CWebLogRoute.

Cheers!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users