0e262d1 optimize queries for image-list

Authored and Committed by Venkatesh Sampath 10 years ago
    optimize queries for image-list
    
    - avoid full table scan on images table by converting,
    images.is_public = 1 OR images.owner = 'OWNER'
    to
    query WHERE images.is_public = 1
    UNION
    query WHERE images.owner = 'OWNER'
    - move image related conditions to the inner union queries
    - remove unwanted union of queries in case of admin querying for image list
    - change the condition images.status != 'killed' to images.status in ('active', 'saving', 'queued', 'pending_delete', 'deleted')
    - convert the correlation subqueries that are used for image_property filters into inner joins
    
    Fixes bug 1211315
    
    depends on bug 1214830
    
    Change-Id: Ie7458044edbe1ef64871bcf5ef4996ed3cc0f957
    
        
file modified
+147 -96