Bug 1347996

Summary: Add index for better performance to vm disks usage tables
Product: Red Hat Enterprise Virtualization Manager Reporter: Shirly Radco <sradco>
Component: ovirt-engine-dwhAssignee: Shirly Radco <sradco>
Status: CLOSED ERRATA QA Contact: Eldad Marciano <emarcian>
Severity: medium Docs Contact:
Priority: high    
Version: 3.6.8CC: bmcclain, bugs, eberman, gklein, juwu, lsurette, oourfali, rbalakri, Rhev-m-bugs, sbonazzo, sradco, srevivo, ykaul, ylavi
Target Milestone: ovirt-3.6.8Keywords: Improvement, ZStream
Target Release: 3.6.8   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
With this update, an index to vm disks usage tables was added to improve query performance. Querying the tables and related views are now faster.
Story Points: ---
Clone Of:
: 1350313 (view as bug list) Environment:
Last Closed: 2016-07-27 14:11:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Metrics RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1350313    
Attachments:
Description Flags
ran these queries to validate performance with new index
none
ran these queries to validate performance with new index
none
ran these queries to validate performance with new index
none
ran these queries to validate performance with new index none

Description Shirly Radco 2016-06-19 19:59:54 UTC
Description of problem:
Add index for better performance to vm disks usage tables

Version-Release number of selected component (if applicable):
4.0

How reproducible:


Steps to Reproduce:
1.Test query results against the tables in scale env before and after the change.

Comment 1 Oved Ourfali 2016-06-22 06:44:48 UTC
Shirly - this isn't posted/merged in 4.0, so can't move to modified.
Alexander's patch is already merged on 4.0. Can you make sure to backport this ASAP?

Comment 5 Shirly Radco 2016-07-12 06:51:04 UTC
This was in 3.6.8 build but I can't manage to add the target release for it.

Comment 6 Sandro Bonazzola 2016-07-12 13:18:01 UTC
Shirly, where's the 4.0 bug?

Comment 7 Shirly Radco 2016-07-12 14:27:59 UTC
(In reply to Sandro Bonazzola from comment #6)
> Shirly, where's the 4.0 bug?

ydary said we don't need another bug for it.
Yaniv, am I right?

Comment 9 Julie 2016-07-13 07:44:17 UTC
Thanks!

Comment 10 eberman 2016-07-19 10:28:09 UTC
Created attachment 1181571 [details]
ran these queries to validate performance with new index

Comment 11 eberman 2016-07-19 10:28:45 UTC
Created attachment 1181572 [details]
ran these queries to validate performance with new index

Comment 12 eberman 2016-07-19 10:29:10 UTC
Created attachment 1181573 [details]
ran these queries to validate performance with new index

Comment 13 eberman 2016-07-19 10:29:30 UTC
Created attachment 1181574 [details]
ran these queries to validate performance with new index

Comment 14 eberman 2016-07-19 10:37:36 UTC
Ran attached (cpu,samples.available_disk_size_gb +samples.used_disk_size_gb ,etc,,,) quires to validate performance time with new added index on system topology with simulated 500 hosts, 9.9K vms, ~30K disks.


[root@bkr-hv05 ~]# time psql -U ovirt_engine_history -f dash.sql
 cpu_total_vms | cpu_used_vms | mem_total_vms | mem_used_vms 
---------------+--------------+---------------+--------------
          9977 |         8073 |       1287808 |      1044096
(1 row)


real	0m0.315s
user	0m0.000s
sys	0m0.002s
[root@bkr-hv05 ~]# time psql -U ovirt_engine_history -f dashstg.sql
 total_vms | used_vms 
-----------+----------
    257872 |        5
(1 row)


real	0m0.452s
user	0m0.001s
sys	0m0.007s
[root@bkr-hv05 ~]# time psql -U ovirt_engine_history -f dashstgtotal.sql
 total 
-------
   441
(1 row)


real	0m0.007s
user	0m0.001s
sys	0m0.001s
[root@bkr-hv05 ~]# time psql -U ovirt_engine_history -f dashsthourly.sql
      the_date       | used 
---------------------+------
 2016-07-18 06:00:00 |     
 2016-07-18 07:00:00 |     
 2016-07-18 08:00:00 |     
 2016-07-18 09:00:00 |     
 2016-07-18 10:00:00 |  342
 2016-07-18 11:00:00 |  342
 2016-07-18 12:00:00 |  342
 2016-07-18 13:00:00 |  342
 2016-07-18 14:00:00 |  342
 2016-07-18 15:00:00 |  342
 2016-07-18 16:00:00 |  342
 2016-07-18 17:00:00 |  342
 2016-07-18 18:00:00 |  342
 2016-07-18 19:00:00 |  342
 2016-07-18 20:00:00 |  342
 2016-07-18 21:00:00 |  342
 2016-07-18 22:00:00 |  342
 2016-07-18 23:00:00 |  342
 2016-07-19 00:00:00 |  342
 2016-07-19 01:00:00 |  342
 2016-07-19 02:00:00 |  342
 2016-07-19 03:00:00 |  342
 2016-07-19 04:00:00 |  342
 2016-07-19 05:00:00 |  342
 2016-07-19 06:00:00 |     
(25 rows)


real	0m0.008s
user	0m0.001s
sys	0m0.002 

closing

Comment 16 errata-xmlrpc 2016-07-27 14:11:01 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-1516.html