简体   繁体   English

显示所有活动记录查询

[英]Display all active record queries

in my test mongrel server output for a page, 8 queries are listed but many more DB are counted: 在我的页面的测试杂种服务器输出中,列出了8个查询,但还计算了更多的数据库:

Query1 Query2 ... Query8 Rendered Partial1 Rendered Partial2 .. Rendered Partial40 Completed in 4754ms (View: 308, DB: 2246) | Query1 Query2 ... Query8 Rendered Partial1 Rendered Partial2 .. Rendered Partial40在4754ms中完成(查看:308,DB:2246)| 200 OK 200 OK

how do I show all the queries that are running? 如何显示所有正在运行的查询?

Also, is there documentation for what the View; 另外,是否有关于View的文档; count represents? 计数代表什么?

I'm not sure I understand the question, but are you asking what the number after DB means? 我不确定我是否理解这个问题,但是您是否在问DB后面的数字是什么意思? If so, it's the number of records returned. 如果是这样,则为返回的记录数。

Some sample output from my Mongrel server: 我的Mongrel服务器的一些示例输出:

Processing AlbumsController#show to xml (for 127.0.0.1 at 2009-12-22 06:44:38) [GET]
  Parameters: {"format"=>"xml", "action"=>"show", "id"=>"1", "controller"=>"albums"}
  Album Load (0.1ms)   SELECT * FROM `albums` WHERE (`albums`.`id` = '1') LIMIT 1
  Album Columns (0.8ms)   SHOW FIELDS FROM `albums`
  Artist Columns (2.0ms)   SHOW FIELDS FROM `artists`
  Artist Load (0.1ms)   SELECT * FROM `artists` WHERE (`artists`.`id` = 1) 
  Track Load (0.1ms)   SELECT * FROM `tracks` WHERE (`tracks`.album_id = 1) 
  Track Columns (1.3ms)   SHOW FIELDS FROM `tracks`
Completed in 48ms (View: 1, DB: 22) | 200 OK [http://localhost/albums/1.xml]

You see only 3 queries here, but 22 records are returned. 您在这里仅看到3个查询,但返回了22条记录。 If you want to see all of the records that are being shown, display them in your templates. 如果要查看所有显示的记录,请在模板中显示它们。 Or, you could easily display them in XML in your controller. 或者,您可以轻松地在控制器中以XML显示它们。

def index
  @records = Record.find(:all)
  respond_to do |format|
    format.xml { render :xml => @records }
  end
end

Long story short, you are seeing all of the queries. 长话短说,您将看到所有查询。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM