View Issue Details

IDProjectCategoryView StatusLast Update
598RackTablesdefaultpublic2013-06-09 08:56
ReporterAddress89 Assigned Toandriyanov  
PrioritynormalSeverityminorReproducibilityunable to reproduce
Status closedResolutionunable to reproduce 
Product Version0.19.14 
Summary598: slow SQL query for OBJECTS page
DescriptionOBJECTS page SQL runs slowly (with 500 objects takes about 30 seconds to show page)
Steps To Reproduceload 500 objects into racktables and click on OBJECTS page
Additional InformationA fix is to tweak SQL as follows:

wwwroot/inc# diff -c database.php database.php.201*
*** database.php Fri Sep 7 11:26:43 2012
--- database.php.20120907 Mon Sep 3 02:34:10 2012
***************
*** 22,28 ****
                        'label' => 'label',
                        'asset_no' => 'asset_no',
                        'objtype_id' => 'objtype_id',
! 'rack_id' => '(SELECT distinct rack_id FROM RackSpace WHERE object_id = RackObject.id LIMIT 1)',
                        'rack_id_2' => "(SELECT parent_entity_id AS rack_id FROM EntityLink WHERE child_entity_type='object' AND child_entity_id = RackObject.id AND parent_entity_type = 'rack' ORDER BY rack_id ASC LIMIT 1)",
                        'Rack_name' => '(select name from Rack where id = rack_id)',
                        'row_id' => '(select row_id from Rack where id = rack_id)',
--- 22,28 ----
                        'label' => 'label',
                        'asset_no' => 'asset_no',
                        'objtype_id' => 'objtype_id',
! 'rack_id' => '(SELECT rack_id FROM RackSpace WHERE object_id = RackObject.id ORDER BY rack_id ASC LIMIT 1)',
                        'rack_id_2' => "(SELECT parent_entity_id AS rack_id FROM EntityLink WHERE child_entity_type='object' AND child_entity_id = RackObject.id AND parent_entity_type = 'rack' ORDER BY rack_id ASC LIMIT 1)",
                        'Rack_name' => '(select name from Rack where id = rack_id)',
                        'row_id' => '(select row_id from Rack where id = rack_id)',
TagsNo tags attached.
Attached Files
issue-598.patch (830 bytes)   
diff --git a/wwwroot/inc/database.php b/wwwroot/inc/database.php
index 0529122..fe295ea 100644
--- a/wwwroot/inc/database.php
+++ b/wwwroot/inc/database.php
@@ -22,7 +22,7 @@ $SQLSchema = array
 			'label' => 'label',
 			'asset_no' => 'asset_no',
 			'objtype_id' => 'objtype_id',
-			'rack_id' => '(SELECT rack_id FROM RackSpace WHERE object_id = RackObject.id ORDER BY rack_id ASC LIMIT 1)',
+			'rack_id' => '(SELECT distinct rack_id FROM RackSpace WHERE object_id = RackObject.id LIMIT 1)',
 			'rack_id_2' => "(SELECT parent_entity_id AS rack_id FROM EntityLink WHERE child_entity_type='object' AND child_entity_id = RackObject.id AND parent_entity_type = 'rack' ORDER BY rack_id ASC LIMIT 1)",
 			'Rack_name' => '(select name from Rack where id = rack_id)',
 			'row_id' => '(select row_id from Rack where id = rack_id)',
issue-598.patch (830 bytes)   

Activities

infrastation

infrastation

2012-09-10 19:06

administrator   ~0000781

Attached file is the proposed change in unified format.
andriyanov

andriyanov

2012-09-15 23:46

reporter   ~0000791

I don't see any improvement on my 0.20.0 installation while the subquery remained the same as in 0.19.14. Do you have a performance issue with 0.20.0, too?
andriyanov

andriyanov

2013-06-09 08:56

reporter   ~0001499

no feedback provided, closing.

Issue History

Date Modified Username Field Change
2012-09-07 03:51 Address89 New Issue
2012-09-10 19:03 infrastation File Added: issue-598.patch
2012-09-10 19:06 infrastation Note Added: 0000781
2012-09-10 19:06 infrastation Assigned To => andriyanov
2012-09-10 19:06 infrastation Status new => assigned
2012-09-15 23:46 andriyanov Note Added: 0000791
2012-09-15 23:47 andriyanov Reproducibility always => unable to reproduce
2013-06-09 08:56 andriyanov Note Added: 0001499
2013-06-09 08:56 andriyanov Status assigned => closed
2013-06-09 08:56 andriyanov Resolution open => unable to reproduce