Skip to content

Instantly share code, notes, and snippets.

@lfittl
Created September 2, 2009 09:14
Show Gist options
  • Select an option

  • Save lfittl/179620 to your computer and use it in GitHub Desktop.

Select an option

Save lfittl/179620 to your computer and use it in GitHub Desktop.
Limit (cost=0.00..177216.77 rows=40 width=16)
-> Index Scan Backward using posts_for_friendposts on posts (cost=0.00..418196124.71 rows=94392 width=16)
Filter: ((NOT deleted) AND (blog_id = ANY ('{134368,136333,136043,134837,144282,142198,134939,140991,134222,134158,142307,142012,142154,140746,140586,137319,138615,140870,138400,140353,134166,140437,138984,139962,139804,136704,134196,138305,135312,137821,136401,138154,135297,138358,135028,137449,134756,135892,138312,134105,135529,137476,137521,136381,136005,134700,134288,134263,136394,135117,134938,137192,134630,136807,136787,135505,136589,134209,135420,135010,134165,134541,135575,135987,134243,136687,134220,134225,134219,134267,134283,135877,134951,134955,135315,134163,134237,134320,134890,134119,136390,136406,134128,136332,135851,134162,134112,134124,136379,136359,134109,134156,135989,134239,136229,135278,136393,134327,136403,136342,134136,136395,134968,134134,136405,136188,134922,134101,135030,134104,134576,134121,134157,135216,123374,136106,136398,134103,136203,136337,134223,136385,134125,134145,134164,134221,134153,134111,135890,134117,134632,136162,134893,134204,134144,134214,134991,134206,134224,134147,134228,134118}'::bigint[])) AND ((parent_id IS NULL) OR edited_after_repost OR ((NOT (subplan)) AND (NOT (subplan)))))
SubPlan
-> Index Scan using posts_pkey1 on posts original (cost=0.05..7.40 rows=1 width=241)
Index Cond: (id = post_original($1))
Filter: (blog_id = ANY ('{134368,136333,136043,134837,144282,142198,134939,140991,134222,134158,142307,142012,142154,140746,140586,137319,138615,140870,138400,140353,134166,140437,138984,139962,139804,136704,134196,138305,135312,137821,136401,138154,135297,138358,135028,137449,134756,135892,138312,134105,135529,137476,137521,136381,136005,134700,134288,134263,136394,135117,134938,137192,134630,136807,136787,135505,136589,134209,135420,135010,134165,134541,135575,135987,134243,136687,134220,134225,134219,134267,134283,135877,134951,134955,135315,134163,134237,134320,134890,134119,136390,136406,134128,136332,135851,134162,134112,134124,136379,136359,134109,134156,135989,134239,136229,135278,136393,134327,136403,136342,134136,136395,134968,134134,136405,136188,134922,134101,135030,134104,134576,134121,134157,135216,123374,136106,136398,134103,136203,136337,134223,136385,134125,134145,134164,134221,134153,134111,135890,134117,134632,136162,134893,134204,134144,134214,134991,134206,134224,134147,134228,134118}'::bigint[]))
-> Index Scan using posts_repost_info on posts previous (cost=0.00..9.32 rows=1 width=241)
Index Cond: ((original_id = $0) AND (created_at >= ($2 - '72:00:00'::interval)) AND (created_at <= $2))
Filter: ((NOT deleted) AND (id <> $1) AND (blog_id = ANY ('{134368,136333,136043,134837,144282,142198,134939,140991,134222,134158,142307,142012,142154,140746,140586,137319,138615,140870,138400,140353,134166,140437,138984,139962,139804,136704,134196,138305,135312,137821,136401,138154,135297,138358,135028,137449,134756,135892,138312,134105,135529,137476,137521,136381,136005,134700,134288,134263,136394,135117,134938,137192,134630,136807,136787,135505,136589,134209,135420,135010,134165,134541,135575,135987,134243,136687,134220,134225,134219,134267,134283,135877,134951,134955,135315,134163,134237,134320,134890,134119,136390,136406,134128,136332,135851,134162,134112,134124,136379,136359,134109,134156,135989,134239,136229,135278,136393,134327,136403,136342,134136,136395,134968,134134,136405,136188,134922,134101,135030,134104,134576,134121,134157,135216,123374,136106,136398,134103,136203,136337,134223,136385,134125,134145,134164,134221,134153,134111,135890,134117,134632,136162,134893,134204,134144,134214,134991,134206,134224,134147,134228,134118}'::bigint[])))
SELECT posts.id FROM posts WHERE posts.blog_id IN (134368,136333,136043,134837,144282,142198,134939,140991,134222,134158,142307,142012,142154,140746,140586,137319,138615,140870,138400,140353,134166,140437,138984,139962,139804,136704,134196,138305,135312,137821,136401,138154,135297,138358,135028,137449,134756,135892,138312,134105,135529,137476,137521,136381,136005,134700,134288,134263,136394,135117,134938,137192,134630,136807,136787,135505,136589,134209,135420,135010,134165,134541,135575,135987,134243,136687,134220,134225,134219,134267,134283,135877,134951,134955,135315,134163,134237,134320,134890,134119,136390,136406,134128,136332,135851,134162,134112,134124,136379,136359,134109,134156,135989,134239,136229,135278,136393,134327,136403,136342,134136,136395,134968,134134,136405,136188,134922,134101,135030,134104,134576,134121,134157,135216,123374,136106,136398,134103,136203,136337,134223,136385,134125,134145,134164,134221,134153,134111,135890,134117,134632,136162,134893,134204,134144,134214,134991,134206,134224,134147,134228,134118) AND TRUE AND (posts.parent_id is null OR posts.edited_after_repost OR NOT EXISTS ( SELECT * FROM posts previous WHERE not previous.deleted AND previous.original_id = posts.original_id AND previous.id <> posts.id AND previous.blog_id IN (134368,136333,136043,134837,144282,142198,134939,140991,134222,134158,142307,142012,142154,140746,140586,137319,138615,140870,138400,140353,134166,140437,138984,139962,139804,136704,134196,138305,135312,137821,136401,138154,135297,138358,135028,137449,134756,135892,138312,134105,135529,137476,137521,136381,136005,134700,134288,134263,136394,135117,134938,137192,134630,136807,136787,135505,136589,134209,135420,135010,134165,134541,135575,135987,134243,136687,134220,134225,134219,134267,134283,135877,134951,134955,135315,134163,134237,134320,134890,134119,136390,136406,134128,136332,135851,134162,134112,134124,136379,136359,134109,134156,135989,134239,136229,135278,136393,134327,136403,136342,134136,136395,134968,134134,136405,136188,134922,134101,135030,134104,134576,134121,134157,135216,123374,136106,136398,134103,136203,136337,134223,136385,134125,134145,134164,134221,134153,134111,135890,134117,134632,136162,134893,134204,134144,134214,134991,134206,134224,134147,134228,134118) AND previous.created_at BETWEEN posts.created_at - interval '72 hours' and posts.created_at AND TRUE) AND NOT EXISTS ( SELECT * FROM posts original WHERE original.id = post_original(posts.id) AND original.blog_id IN (134368,136333,136043,134837,144282,142198,134939,140991,134222,134158,142307,142012,142154,140746,140586,137319,138615,140870,138400,140353,134166,140437,138984,139962,139804,136704,134196,138305,135312,137821,136401,138154,135297,138358,135028,137449,134756,135892,138312,134105,135529,137476,137521,136381,136005,134700,134288,134263,136394,135117,134938,137192,134630,136807,136787,135505,136589,134209,135420,135010,134165,134541,135575,135987,134243,136687,134220,134225,134219,134267,134283,135877,134951,134955,135315,134163,134237,134320,134890,134119,136390,136406,134128,136332,135851,134162,134112,134124,136379,136359,134109,134156,135989,134239,136229,135278,136393,134327,136403,136342,134136,136395,134968,134134,136405,136188,134922,134101,135030,134104,134576,134121
,134157,135216,123374,136106,136398,134103,136203,136337,134223,136385,134125,134145,134164,134221,134153,134111,135890,134117,134632,136162,134893,134204,134144,134214,134991,134206,134224,134147,134228,134118) AND TRUE)) AND not posts.deleted AND TRUE ORDER BY posts.created_at DESC, posts.id DESC LIMIT 40;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment