#0.01


                                                                       QUERY PLAN

---------------------------------------------------------------------------------------------------------------------------------------------------------
 Unique  (cost=973.16..973.94 rows=10 width=132) (actual time=428.11..442.09 rows=96 loops=1)
   ->  Sort  (cost=973.16..973.42 rows=104 width=132) (actual time=428.10..433.40 rows=4656 loops=1)
         Sort Key: xn3.docid, xn3.id
         ->  Nested Loop  (cost=0.00..969.66 rows=104 width=132) (actual time=65.51..368.89 rows=4656 loops=1)
               Join Filter: ("outer".dewey < "inner".dewey)
               ->  Nested Loop  (cost=0.00..120.68 rows=61 width=66) (actual time=34.83..39.93 rows=97 loops=1)
                     ->  Seq Scan on xml_path xp2  (cost=0.00..22.74 rows=1 width=4) (actual time=34.75..38.20 rows=1 loops=1)
                           Filter: (pathexp ~~ '#%/closed_auction'::text)
                     ->  Index Scan using xml_node_pathid on xml_node xn2  (cost=0.00..96.39 rows=124 width=62) (actual time=0.05..1.02 rows=97 loops=1)
                           Index Cond: (xn2.pathid = "outer".pathid)
               ->  Index Scan using xml_node_parent on xml_node xn3  (cost=0.00..13.94 rows=3 width=66) (actual time=0.56..2.89 rows=97 loops=97)
                     Index Cond: (xn3.parent = "outer".parent)
                     Filter: ((kind > 0) AND (kind < 5) AND (kind = 1::smallint))
 Total runtime: 443.21 msec
(14 rows)

#0.03
                                                                        QUERY PLAN

-----------------------------------------------------------------------------------------------------------------------------------------------------------
 Unique  (cost=3152.62..3158.90 rows=84 width=136) (actual time=2736.51..2867.59 rows=287 loops=1)
   ->  Sort  (cost=3152.62..3154.71 rows=837 width=136) (actual time=2736.50..2783.96 rows=41328 loops=1)
         Sort Key: xn3.docid, xn3.id
         ->  Nested Loop  (cost=0.00..3111.99 rows=837 width=136) (actual time=95.59..2244.11 rows=41328 loops=1)
               Join Filter: ("outer".dewey < "inner".dewey)
               ->  Nested Loop  (cost=0.00..326.43 rows=162 width=68) (actual time=60.09..68.30 rows=288 loops=1)
                     ->  Seq Scan on xml_path xp2  (cost=0.00..24.80 rows=1 width=4) (actual time=60.02..63.33 rows=1 loops=1)
                           Filter: (pathexp ~~ '#%/closed_auction'::text)
                     ->  Index Scan using xml_node_pathid on xml_node xn2  (cost=0.00..297.77 rows=309 width=64) (actual time=0.05..2.99 rows=288 loops=1)
                           Index Cond: (xn2.pathid = "outer".pathid)
               ->  Index Scan using xml_node_parent on xml_node xn3  (cost=0.00..17.15 rows=4 width=68) (actual time=2.08..6.03 rows=288 loops=288)
                     Index Cond: (xn3.parent = "outer".parent)
                     Filter: ((kind > 0) AND (kind < 5) AND (kind = 1::smallint))
 Total runtime: 2885.03 msec
(14 rows)

                                                                        QUERY PLAN

-----------------------------------------------------------------------------------------------------------------------------------------------------------
 Unique  (cost=1322.69..1331.08 rows=112 width=134) (actual time=8146.60..8510.05 rows=486 loops=1)
   ->  Sort  (cost=1322.69..1325.49 rows=1119 width=134) (actual time=8146.58..8290.18 rows=118341 loops=1)
         Sort Key: xn3.docid, xn3.id
         ->  Nested Loop  (cost=0.00..1266.04 rows=1119 width=134) (actual time=105.27..6818.06 rows=118341 loops=1)
               Join Filter: ("outer".dewey < "inner".dewey)
               ->  Nested Loop  (cost=0.00..249.62 rows=259 width=67) (actual time=64.39..78.13 rows=487 loops=1)
                     ->  Seq Scan on xml_path xp2  (cost=0.00..26.30 rows=1 width=4) (actual time=64.09..67.42 rows=1 loops=1)
                           Filter: (pathexp ~~ '#%/closed_auction'::text)
                     ->  Index Scan using xml_node_pathid on xml_node xn2  (cost=0.00..216.82 rows=520 width=63) (actual time=0.27..6.78 rows=487 loops=1)
                           Index Cond: (xn2.pathid = "outer".pathid)
               ->  Index Scan using xml_node_parent on xml_node xn3  (cost=0.00..3.86 rows=4 width=67) (actual time=0.11..11.14 rows=487 loops=487)
                     Index Cond: (xn3.parent = "outer".parent)
                     Filter: ((kind > 0) AND (kind < 5) AND (kind = 1::smallint))
 Total runtime: 8542.58 msec
(14 rows)
