Bug 984962

Summary: SearchQuery generates slow query on vds_with_tags
Product: Red Hat Enterprise Virtualization Manager Reporter: Liran Zelkha <lzelkha>
Component: ovirt-engineAssignee: Liran Zelkha <lzelkha>
Status: CLOSED DUPLICATE QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: acathrow, bazulay, iheim, lpeer, pstehlik, Rhev-m-bugs, yeylon, yzaslavs
Target Milestone: ---Keywords: Triaged
Target Release: 3.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: infra
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-05 13:20:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Liran Zelkha 2013-07-16 13:39:51 UTC
Description of problem:
When AutoRecoveryManager runs it generates a query to select all VDS with a specific group name. This query is slow and can be optimized easily.

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


How reproducible:
Run engine.

Steps to Reproduce:
1. Connect with a profiler to engine, and examine queries.
2.
3.

Actual results:
Generated query is:
SELECT * FROM (SELECT * FROM vds WHERE ( vds_id IN (SELECT vds_with_tags.vds_id FROM  vds_with_tags   WHERE  vds_with_tags.vds_group_name LIKE 'Default' ))  ORDER BY vds_name ASC ,vds_name ASC ) as T1 OFFSET (1 -1) LIMIT 2147483647

Expected results:
Should be SELECT * FROM vds WHERE vds_group_name LIKE 'Default' ORDER BY vds_name ASC as T1 OFFSET (1 -1) LIMIT 2147483647

Additional info:

Comment 1 Liran Zelkha 2013-11-05 13:20:44 UTC

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