Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #3748 (closed defect: incomplete)

Opened 3 years ago

Last modified 2 years ago

Multiple databases - DB summary time wrong

Reported by: lori.olson@labradortechnologies.com Assigned to: David
Priority: normal Milestone:
Component: ActiveRecord Version: 1.0.0
Severity: normal Keywords:
Cc:

Description

Here is a log example of a hit to the list action of my controller, where 2 databases are being used. The "conditions" table is in the local "production" database. All the other database tables are located in a separate database on a different machine.

Individually, I can see the database time for each query made (in development mode). But in the action summary at the end, only the database time for the "local" production database is included (DB: 0.02618 (0%)). This is very misleading, especially in production, where I don't see the individual query times.

Processing WellListController#list (for 127.0.0.1 at 2006-02-06 11:32:28) [GET]

Parameters: {"action"=>"list", "controller"=>"well_list"} Condition Load (0.001013) SELECT * FROM conditions WHERE (conditions.search_id = 13) OperatorCondition Columns (0.006002) SHOW FIELDS FROM conditions Well Columns (0.016398)

select column_name, data_type, data_default, nullable, decode(data_type, 'NUMBER', data_precision, 'VARCHAR2', data_length, null) as length, decode(data_type, 'NUMBER', data_scale, null) as scale from user_catalog cat, user_synonyms syn, all_tab_columns col where cat.table_name = 'WELL' and syn.synonym_name (+)= cat.table_name and col.table_name = nvl(syn.table_name, cat.table_name) and col.owner = nvl(syn.table_owner, user)

Well Count (0.019738) SELECT COUNT(*) FROM well WHERE (OPERATOR IN ( SELECT BUSINESS_ASSOCIATE FROM BUSINESS_ASSOCIATE WHERE LOWER(BA_NAME) LIKE '%sh%')) Well Load (0.054383) select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT * FROM well WHERE (OPERATOR IN ( SELECT BUSINESS_ASSOCIATE FROM BUSINESS_ASSOCIATE WHERE LOWER(BA_NAME) LIKE '%sh%')) ) raw_sql_ where rownum <= 10) where raw_rnum_ > 0

Rendering within layouts/application Rendering well_list/list

RWellStatus Columns (0.010251)

select column_name, data_type, data_default, nullable, decode(data_type, 'NUMBER', data_precision, 'VARCHAR2', data_length, null) as length, decode(data_type, 'NUMBER', data_scale, null) as scale from user_catalog cat, user_synonyms syn, all_tab_columns col where cat.table_name = 'R_WELL_STATUS' and syn.synonym_name (+)= cat.table_name and col.table_name = nvl(syn.table_name, cat.table_name) and col.owner = nvl(syn.table_owner, user)

RWellStatus Load (0.014428) select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT * FROM r_well_status WHERE (r_well_status.status = '00030000') ) raw_sql_ where rownum <= 1) where raw_rnum_ > 0 ProductionEntityWell Columns (0.007681)

select column_name, data_type, data_default, nullable, decode(data_type, 'NUMBER', data_precision, 'VARCHAR2', data_length, null) as length, decode(data_type, 'NUMBER', data_scale, null) as scale from user_catalog cat, user_synonyms syn, all_tab_columns col where cat.table_name = 'PDEN_WELL' and syn.synonym_name (+)= cat.table_name and col.table_name = nvl(syn.table_name, cat.table_name) and col.owner = nvl(syn.table_owner, user)

ProductionEntityWell Load (0.009062) select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT * FROM pden_well WHERE (pden_well.UWI = '0555051107022') ) raw_sql_ where rownum <= 1) where raw_rnum_ > 0 RWellStatus Load (0.015663) select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT * FROM r_well_status WHERE (r_well_status.status = '02010000') ) raw_sql_ where rownum <= 1) where raw_rnum_ > 0 ProductionEntityWell Load (0.009083) select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT * FROM pden_well WHERE (pden_well.UWI = '0555051107023') ) raw_sql_ where rownum <= 1) where raw_rnum_ > 0 ProductionEntityWell Load (0.008181) select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT * FROM pden_well WHERE (pden_well.UWI = '0555051111020') ) raw_sql_ where rownum <= 1) where raw_rnum_ > 0 RWellStatus Load (0.014005) select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT * FROM r_well_status WHERE (r_well_status.status = '02100000') ) raw_sql_ where rownum <= 1) where raw_rnum_ > 0 ProductionEntityWell Load (0.010287) select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT * FROM pden_well WHERE (pden_well.UWI = '0555051111022') ) raw_sql_ where rownum <= 1) where raw_rnum_ > 0 RWellStatus Load (0.008513) select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT * FROM r_well_status WHERE (r_well_status.status = '00070000') ) raw_sql_ where rownum <= 1) where raw_rnum_ > 0 ProductionEntityWell Load (0.010116) select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT * FROM pden_well WHERE (pden_well.UWI = '0555051112000') ) raw_sql_ where rownum <= 1) where raw_rnum_ > 0 ProductionEntityWell Load (0.014742) select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT * FROM pden_well WHERE (pden_well.UWI = '0555051112002') ) raw_sql_ where rownum <= 1) where raw_rnum_ > 0 RWellStatus Load (0.014744) select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT * FROM r_well_status WHERE (r_well_status.status = '06010300') ) raw_sql_ where rownum <= 1) where raw_rnum_ > 0 ProductionEntityWell Load (0.023254) select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT * FROM pden_well WHERE (pden_well.UWI = '0555051606000') ) raw_sql_ where rownum <= 1) where raw_rnum_ > 0 RWellStatus Load (0.008389) select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT * FROM r_well_status WHERE (r_well_status.status = '01110000') ) raw_sql_ where rownum <= 1) where raw_rnum_ > 0 ProductionEntityWell Load (0.024230) select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT * FROM pden_well WHERE (pden_well.UWI = '0555051607000') ) raw_sql_ where rownum <= 1) where raw_rnum_ > 0 ProductionEntityWell Load (0.008161) select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT * FROM pden_well WHERE (pden_well.UWI = '0555051608000') ) raw_sql_ where rownum <= 1) where raw_rnum_ > 0 ProductionEntityWell Load (0.011345) select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT * FROM pden_well WHERE (pden_well.UWI = '0555051609000') ) raw_sql_ where rownum <= 1) where raw_rnum_ > 0

Rendered well_list/_list_table (16.23639) Rendered shared/_header (0.00074) Rendered shared/_navbar (0.00173) Rendered shared/_footer (0.00083) Completed in 21.23575 (0 reqs/sec) | Rendering: 16.32746 (76%) | DB: 0.02618 (0%) | 200 OK http://localhost/well_list/list

Change History

(follow-up: ↓ 2 ) 06/18/07 02:24:31 changed by josh

  • status changed from new to closed.
  • resolution set to invalid.

(in reply to: ↑ 1 ) 06/19/07 13:07:51 changed by jeremymcanally

  • status changed from closed to reopened.
  • resolution deleted.

Replying to josh: Why is this invalid? Is it worksforme? wontfix? Need unit tests? If it needs unit tests, please ask and don't close the ticket unless you've asked before. A lot of times I forget about tickets and will submit tests when asked.

06/19/07 14:52:18 changed by josh

  • status changed from reopened to closed.
  • resolution set to incomplete.

Needs test cases to prove the existence of the bug. Until then it remains closed.

06/19/07 15:42:10 changed by wndxlori

I will try to come up with a unit test for this bug this week.