Project

General

Profile

Bug #4574

Updated by Dominic Cleal over 11 years ago

<pre> 
 foreman=#    explain SELECT    "hosts".* FROM "hosts" INNER JOIN "fact_values" fact_values_372547 ON (hosts.id = fact_values_372547.host_id) INNER JOIN "fact_names" fact_names_372547 ON (fact_names_372547.id = fact_values_372547.fact_name_id) WHERE "hosts"."type" IN ('Host::Managed') AND ((fact_names_372547."name" = 'puppetversion') AND (hosts.id IN (SELECT host_id FROM fact_values WHERE fact_values_372547."value" <> '3.4.3' ))) ORDER BY "hosts"."name" ASC NULLS FIRST    LIMIT 75 OFFSET 0; 
                                                                        QUERY PLAN                                                                         
 --------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Limit    (cost=486984949.13..486984949.32 rows=75 width=2640) 
    ->    Sort    (cost=486984949.13..486984959.77 rows=4257 width=2640) 
          Sort Key: hosts.name 
          ->    Nested Loop    (cost=0.00..486984795.27 rows=4257 width=2640) 
                Join Filter: (SubPlan 1) 
                ->    Nested Loop    (cost=0.00..44849.99 rows=8510 width=23) 
                      ->    Index Scan using index_fact_names_on_name_and_type on fact_names fact_names_372547    (cost=0.00..8.27 rows=1 width=4) 
                            Index Cond: ((name)::text = 'puppetversion'::text) 
                      ->    Index Scan using index_fact_values_on_fact_name_id on fact_values fact_values_372547    (cost=0.00..44687.89 rows=12306 width=27) 
                            Index Cond: (fact_values_372547.fact_name_id = fact_names_372547.id) 
                ->    Index Scan using hosts_pkey on hosts    (cost=0.00..6.02 rows=1 width=2640) 
                      Index Cond: (hosts.id = fact_values_372547.host_id) 
                      Filter: ((hosts.type)::text = 'Host::Managed'::text) 
                SubPlan 1 
                  ->    Result    (cost=0.00..102705.51 rows=4688751 width=4) 
                        One-Time Filter: ($0 <> '3.4.3'::text) 
                        ->    Seq Scan on fact_values    (cost=0.00..102705.51 rows=4688751 width=4) 
 (17 rows) 
 </pre>

Back