The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
# - plan copied from http://explain-analyze.info/ - only for testing purposes

 Limit  (cost=186.82..186.82 rows=1 width=359) (actual time=1352.355..1352.405 rows=50 loops=1)
   ->  Sort  (cost=186.82..186.82 rows=1 width=359) (actual time=1352.354..1352.373 rows=50 loops=1)
         Sort Key: s.last_updated_date
         Sort Method:  top-N heapsort  Memory: 50kB
         ->  Nested Loop Left Join  (cost=2.16..186.81 rows=1 width=359) (actual time=0.733..1271.399 rows=13988 loops=1)
               ->  Nested Loop Left Join  (cost=2.16..186.49 rows=1 width=351) (actual time=0.706..1116.630 rows=13988 loops=1)
                     Filter: ((mu.mls_id IS NULL) OR (mu.mls_update_id = (subplan)))
                     ->  Nested Loop  (cost=2.16..19.03 rows=1 width=321) (actual time=0.676..204.019 rows=13988 loops=1)
                           Join Filter: _st_contains(poly_inter_1.the_geom, s.centroid)
                           ->  Subquery Scan poly_inter_1  (cost=2.16..2.44 rows=1 width=32) (actual time=0.520..0.531 rows=1 loops=1)
                                 Filter: (st_geometrytype(poly_inter_1.the_geom) ~~* '%polygon%'::text)
                                 ->  Result  (cost=2.16..2.18 rows=1 width=0) (actual time=0.433..0.441 rows=1 loops=1)
                                       InitPlan
                                         ->  Seq Scan on markets  (cost=0.00..2.15 rows=1 width=32) (actual time=0.015..0.020 rows=1 loops=1)
                                               Filter: ((name)::text = 'seattle'::text)
                                         ->  Result  (cost=0.00..0.01 rows=1 width=0) (actual time=0.048..0.050 rows=1 loops=1)
                           ->  Index Scan using listing_search_keys_centroid on listing_search_keys s  (cost=0.00..16.58 rows=1 width=421) (actual time=0.131..139.571 rows=13988 loops=1)
                                 Index Cond: (poly_inter_1.the_geom && s.centroid)
                                 Filter: ((NOT s.is_townhome) AND (s.property_type_id = ANY ('{3,6}'::bigint[])) AND (s.access_level <= 3) AND (s.listing_type_id = ANY ('{1,2,3}'::integer[])) AND (0 <> (s.search_status_id & 1)) AND (s.last_updated_date >= (('now'::text)::date - '7 days'::interval)))
                     ->  Index Scan using mls_updates_listing_id_and_field on mls_updates mu  (cost=0.00..4.19 rows=7 width=55) (actual time=0.010..0.012 rows=2 loops=13988)
                           Index Cond: (mu.listing_id = s.listing_id)
                           Filter: (((mu.mls_column_updated)::text <> 'search_status_id'::text) OR (((mu.mls_column_old_value)::text <> '32'::text) AND ((mu.mls_column_new_value)::text <> '32'::text)))
                     SubPlan
                       ->  Limit  (cost=23.31..23.31 rows=1 width=16) (actual time=0.030..0.031 rows=1 loops=22035)
                             ->  Sort  (cost=23.31..23.32 rows=7 width=16) (actual time=0.029..0.029 rows=1 loops=22035)
                                   Sort Key: mu2.update_date
                                   Sort Method:  quicksort  Memory: 25kB
                                   ->  Index Scan using mls_updates_listing_id_and_field on mls_updates mu2  (cost=0.00..23.27 rows=7 width=16) (actual time=0.005..0.019 rows=12 loops=22035)
                                         Index Cond: (listing_id = $0)
                                         Filter: (((mls_column_updated)::text <> 'search_status_id'::text) OR (((mls_column_old_value)::text <> '32'::text) AND ((mls_column_new_value)::text <> '32'::text)))
               ->  Index Scan using markets_pkey on markets m  (cost=0.00..0.27 rows=1 width=16) (actual time=0.002..0.003 rows=1 loops=13988)
                     Index Cond: (s.primary_market_id = m.market_id)
 Total runtime: 1352.834 ms
(33 rows)