Skip to content

Instantly share code, notes, and snippets.

@Pistos
Created March 2, 2012 04:04
Show Gist options
  • Select an option

  • Save Pistos/1955547 to your computer and use it in GitHub Desktop.

Select an option

Save Pistos/1955547 to your computer and use it in GitHub Desktop.
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=2165.44..2165.48 rows=15 width=20) (actual time=16135.897..16135.922 rows=15 loops=1)
-> Sort (cost=2165.44..2165.48 rows=16 width=20) (actual time=16135.894..16135.902 rows=15 loops=1)
Sort Key: public.posts.updated_at
Sort Method: quicksort Memory: 18kB
-> Append (cost=1763.48..2165.12 rows=16 width=20) (actual time=15783.910..16135.862 rows=30 loops=1)
-> Limit (cost=1763.48..1763.63 rows=15 width=20) (actual time=15783.907..15783.967 rows=15 loops=1)
-> Unique (cost=1763.48..1765.31 rows=183 width=20) (actual time=15783.905..15783.946 rows=15 loops=1)
-> Sort (cost=1763.48..1763.94 rows=183 width=20) (actual time=15783.899..15783.911 rows=15 loops=1)
Sort Key: public.posts.updated_at, public.posts.id, public.posts.created_at
Sort Method: quicksort Memory: 1280kB
-> Nested Loop (cost=238.16..1756.60 rows=183 width=20) (actual time=182.668..15675.708 rows=19648 loops=1)
-> Nested Loop (cost=238.16..1680.03 rows=230 width=4) (actual time=182.626..10644.970 rows=20849 loops=1)
-> Hash Join (cost=238.16..507.52 rows=3 width=8) (actual time=155.508..188.854 rows=217 loops=1)
Hash Cond: (contacts.id = aspect_memberships.contact_id)
-> Bitmap Heap Scan on contacts (cost=6.13..266.68 rows=213 width=4) (actual time=17.156..18.312 rows=217 loops=1)
Recheck Cond: (user_id = 1303)
Filter: receiving
-> Bitmap Index Scan on index_contacts_on_user_id_and_person_id (cost=0.00..6.08 rows=243 width=0) (actual time=9.262..9.262 rows=241 loops=1)
Index Cond: (user_id = 1303)
-> Hash (cost=229.16..229.16 rows=230 width=4) (actual time=138.254..138.254 rows=219 loops=1)
Buckets: 1024 Batches: 1 Memory Usage: 6kB
-> Bitmap Heap Scan on aspect_memberships (cost=18.77..229.16 rows=230 width=4) (actual time=11.998..137.818 rows=219 loops=1)
Recheck Cond: (aspect_id = ANY ('{3398,3397,3396,3395}'::integer[]))
-> Bitmap Index Scan on index_aspect_memberships_on_aspect_id (cost=0.00..18.72 rows=230 width=0) (actual time=6.233..6.233 rows=219 loops=1)
Index Cond: (aspect_id = ANY ('{3398,3397,3396,3395}'::integer[]))
-> Index Scan using index_post_visibilities_on_contact_id on share_visibilities (cost=0.00..388.61 rows=178 width=8) (actual time=1.925..48.016 rows=96 loops=217)
Index Cond: (share_visibilities.contact_id = contacts.id)
Filter: ((NOT share_visibilities.hidden) AND ((share_visibilities.shareable_type)::text = 'Post'::text))
-> Index Scan using posts_pkey on posts (cost=0.00..0.32 rows=1 width=20) (actual time=0.236..0.237 rows=1 loops=20849)
Index Cond: (public.posts.id = share_visibilities.shareable_id)
Filter: ((NOT public.posts.pending) AND (public.posts.updated_at < '2012-03-01 17:33:40'::timestamp without time zone) AND ((public.posts.type)::text = ANY ('{StatusMessage,Reshare,ActivityStreams::Photo}'::text[])))
-> Limit (cost=401.31..401.33 rows=1 width=20) (actual time=351.733..351.847 rows=15 loops=1)
-> Unique (cost=401.31..401.33 rows=1 width=20) (actual time=351.731..351.830 rows=15 loops=1)
-> Sort (cost=401.31..401.32 rows=1 width=20) (actual time=351.727..351.770 rows=57 loops=1)
Sort Key: public.posts.updated_at, public.posts.id, public.posts.created_at
Sort Method: quicksort Memory: 42kB
-> Hash Join (cost=118.34..401.30 rows=1 width=20) (actual time=81.176..349.871 rows=641 loops=1)
Hash Cond: (aspect_visibilities.shareable_id = public.posts.id)
-> Bitmap Heap Scan on aspect_visibilities (cost=17.82..300.43 rows=93 width=4) (actual time=70.555..337.580 rows=705 loops=1)
Recheck Cond: (aspect_id = ANY ('{3398,3397,3396,3395}'::integer[]))
Filter: ((shareable_type)::text = 'Post'::text)
-> Bitmap Index Scan on index_aspect_visibilities_on_aspect_id (cost=0.00..17.79 rows=102 width=0) (actual time=55.170..55.170 rows=729 loops=1)
Index Cond: (aspect_id = ANY ('{3398,3397,3396,3395}'::integer[]))
-> Hash (cost=100.23..100.23 rows=23 width=20) (actual time=1.413..1.413 rows=161 loops=1)
Buckets: 1024 Batches: 1 Memory Usage: 7kB
-> Index Scan using index_posts_on_person_id on posts (cost=0.00..100.23 rows=23 width=20) (actual time=0.637..1.192 rows=161 loops=1)
Index Cond: (author_id = 16790)
Filter: ((NOT pending) AND (updated_at < '2012-03-01 17:33:40'::timestamp without time zone) AND ((type)::text = ANY ('{StatusMessage,Reshare,ActivityStreams::Photo}'::text[])))
Total runtime: 16148.847 ms
(49 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment