Skip to content

Instantly share code, notes, and snippets.

@ivanovv
Created February 17, 2015 21:59
Show Gist options
  • Select an option

  • Save ivanovv/dc226ec8746a8028daee to your computer and use it in GitHub Desktop.

Select an option

Save ivanovv/dc226ec8746a8028daee to your computer and use it in GitHub Desktop.
Limit (cost=331597.28..331597.35 rows=29 width=187) (actual time=57145.891..57145.904 rows=30 loops=1)
-> Sort (cost=331597.28..331597.35 rows=29 width=187) (actual time=57145.889..57145.892 rows=30 loops=1)
Sort Key: customers.recurring_since
Sort Method: top-N heapsort Memory: 32kB
-> WindowAgg (cost=304409.86..331596.57 rows=29 width=187) (actual time=57143.748..57145.554 rows=400 loops=1)
-> Nested Loop Left Join (cost=304409.86..331588.74 rows=29 width=187) (actual time=2271.147..57140.744 rows=400 loops=1)
-> Nested Loop Left Join (cost=304409.57..331528.53 rows=29 width=158) (actual time=2271.105..57130.491 rows=400 loops=1
)
Join Filter: (customers.id = summary_mrr.customer_id)
Rows Removed by Join Filter: 107800444
-> Seq Scan on customers (cost=0.00..27008.08 rows=29 width=114) (actual time=1.199..259.649 rows=400 loops=1)
Filter: ((recurring_since IS NOT NULL) AND (account_id = 412) AND (((full_name)::text ~~ '%rus%'::text) OR (de
scription ~~ '%rus%'::text)))
Rows Removed by Filter: 754976
-> Materialize (cost=304409.57..304420.55 rows=231 width=44) (actual time=4.823..75.879 rows=269502 loops=400)
-> Subquery Scan on summary_mrr (cost=304409.57..304419.39 rows=231 width=44) (actual time=1927.393..2221.22
7 rows=269502 loops=1)
-> WindowAgg (cost=304409.57..304417.08 rows=231 width=32) (actual time=1927.390..2121.771 rows=269502
loops=1)
-> WindowAgg (cost=304409.57..304413.62 rows=231 width=32) (actual time=1404.772..1710.508 rows=269502 loops=1)
-> Sort (cost=304409.57..304410.15 rows=231 width=32) (actual time=1404.755..1480.434 rows=269502 loops=1)
Sort Key: customer_summary.mrr
Sort Method: external sort Disk: 13176kB
-> Subquery Scan on customer_summary (cost=303118.81..304400.50 rows=231 width=32) (actual time=536.977..1233.194 rows=269502 loops=1)
-> GroupAggregate (cost=303118.81..304398.19 rows=231 width=16) (actual time=536.975..1135.119 rows=269502 loops=1)
-> Sort (cost=303118.81..303331.66 rows=85138 width=16) (actual time=536.932..638.254 rows=269504 loops=1)
Sort Key: mrrs.customer_id
Sort Method: external merge Disk: 6848kB
-> Bitmap Heap Scan on mrrs (cost=1815.76..296147.07 rows=85138 width=16) (actual time=46.811..263.248 rows=269504 loops=1)
Recheck Cond: ((account_id = 412) AND (date_id = '2015-02-10'::date))
Filter: active
-> Bitmap Index Scan on index_mrrs_on_account_id_and_date_id (cost=0.00..1794.48 rows=85391 width=0) (actual time=45.151..45.151 rows=269504 loops=1)
Index Cond: ((account_id = 412) AND (date_id = '2015-02-10'::date))
-> Index Scan using plans_pkey on plans (cost=0.28..2.07 rows=1 width=37) (actual time=0.017..0.017 rows=1 loops=400)
Index Cond: (summary_mrr.plan_id = id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment