Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1168572

Summary: GetDisksVmGuid stored function is inefficient
Product: Red Hat Enterprise Virtualization Manager Reporter: Tim Speetjens <tspeetje>
Component: ovirt-engineAssignee: Allon Mureinik <amureini>
Status: CLOSED DUPLICATE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3.4.3-1CC: amureini, ecohen, gklein, iheim, lpeer, lsurette, lzelkha, oourfali, rbalakri, Rhev-m-bugs, yeylon
Target Milestone: ovirt-3.6.3Keywords: Performance
Target Release: 3.6.0   
Hardware: x86_64   
OS: Linux   
Whiteboard: storage
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-12-02 12:10:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1142762    
Bug Blocks:    

Description Tim Speetjens 2014-11-27 10:31:00 UTC
Description of problem:
The query used in GetDisksVmGuid is slow

Version-Release number of selected component (if applicable):
RHEV 3.4, but applicable to all versions 

How reproducible:
100%

Steps to Reproduce:
Execute the query with a user that has multiple rights assigned.
Execute explain plan for query with a user that has multiple rights assigned.

Actual results:
Execution of this query is slow using much CPU, and explain plan for this query is bad, when using large dataset.

Expected results:
This query should be more optimized, to avoid using too much CPU

Additional info:
Optimizing it by rewriting the exists clause into a join, doesn't help much, if at all. Other BZs referencing this query have been introduced, and were closed in an errata. However, the query itself hasn't been touched, only the way it is used has been improved.

Comment 1 Allon Mureinik 2014-11-29 07:13:00 UTC
This should be revisited in 3.6.0 after the RFE describing in bug 1142762 is done.

Comment 2 Liran Zelkha 2014-12-02 12:10:34 UTC

*** This bug has been marked as a duplicate of bug 1141543 ***

Comment 3 Liran Zelkha 2014-12-02 12:11:37 UTC
I agree. The query is terrible. I'm working on a trying to use a UNION ALL instead of UNION - will require fine tuning...