# DB query time always 0 in production

**URL:** <https://www.ruby-forum.com/t/db-query-time-always-0-in-production/130683>\
**Category:** Rails\
**Created:** [March 1, 2008, 9:11pm UTC](https://www.ruby-forum.com/t/db-query-time-always-0-in-production/130683 "2008-03-01T21:11:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 1, 2008, 9:11pm UTC](https://www.ruby-forum.com/t/db-query-time-always-0-in-production/130683/1 "2008-03-01T21:11:19Z")

</div>

Hello,

My DB time always shows 0.00000 in production, using thin, mongrel,  
rails 1.2.6, 2.0.2, it doesn’t matter. In development, the DB time is  
correctly non-zero. I don’t do any caching.

Is this a known problem?

Processing ProjectsController#index (for x.x.x.x at 2008-03-01  
12:04:06) [GET]  
Session ID: xxxx  
Parameters: {“action”=\>“index”, “controller”=\>“projects”}  
Rendering template within layouts/main  
Rendering projects/index  
Completed in 0.09227 (10 reqs/sec) | Rendering: 0.03694 (40%) | DB:  
0.00000 (0%) | 200 OK [[http://yyyy.yyy.yyy/](http://yyyy.yyy.yyy/)]

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 3, 2008, 1:03am UTC](https://www.ruby-forum.com/t/db-query-time-always-0-in-production/130683/2 "2008-03-03T01:03:36Z")

</div>

I copied development.rb to production.rb and still have the same  
problem. I suspect database timing is explicitly disabled in  
production mode, can I override this somehow? I have the same  
behavior on freebsd and OSX. For the heck of it I created a new rails  
app and had the same problem.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 3, 2008, 10:46am UTC](https://www.ruby-forum.com/t/db-query-time-always-0-in-production/130683/3 "2008-03-03T10:46:34Z")

</div>

On 3 Mar 2008, at 00:02, bacon wrote:

> I copied development.rb to production.rb and still have the same  
> problem. I suspect database timing is explicitly disabled in  
> production mode, can I override this somehow? I have the same  
> behavior on freebsd and OSX. For the heck of it I created a new rails  
> app and had the same problem.

Well I’ve no idea why this is happening, but database timing certainly  
isn’t disabled in production.

Fred

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 3, 2008, 1:08am UTC](https://www.ruby-forum.com/t/db-query-time-always-0-in-production/130683/4 "2008-03-03T01:08:53Z")

</div>

Here is a log entry in production:

Processing CategoriesController#index (for 127.0.0.1 at 2008-03-02  
15:57:46) [GET]  
Session ID:  
BAh7BzoMY3NyZl9pZCIlMDM0MDBmYzFmZmFhNzNkOWM3OWMyODE4Y2UzZTMw  
%0AZWEiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhh  
%0Ac2h7AAY6CkB1c2VkewA%3D–3900448070a5ee4787c7a73043c9331d6e0388a3  
Parameters: {“action”=\>“index”, “controller”=\>“categories”}  
Rendering categories/index  
Completed in 0.25246 (3 reqs/sec) | Rendering: 0.00867 (3%) | DB:  
0.00000 (0%) | 200 OK [[http://localhost/categories](http://localhost/categories)]

and in development:

Processing CategoriesController#index (for 127.0.0.1 at 2008-03-02  
15:57:11) [GET]  
Session ID:  
BAh7BzoMY3NyZl9pZCIlMDM0MDBmYzFmZmFhNzNkOWM3OWMyODE4Y2UzZTMw  
%0AZWEiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhh  
%0Ac2h7AAY6CkB1c2VkewA%3D–3900448070a5ee4787c7a73043c9331d6e0388a3  
Parameters: {“action”=\>“index”, “controller”=\>“categories”}  
SQL (0.000270) SET SQL\_AUTO\_IS\_NULL=0  
Category Load (0.000395) SELECT \* FROM `categories`  
Entry Load (0.055512) SELECT \* FROM `entries`  
Rendering categories/index  
Category Columns (0.002757) SHOW FIELDS FROM `categories`  
Completed in 0.25735 (3 reqs/sec) | Rendering: 0.00572 (2%) | DB:  
0.05893 (22%) | 200 OK [[http://localhost/categories](http://localhost/categories)]

I’m baffled.
