Skip to content

Instantly share code, notes, and snippets.

@ailabs-software
Created September 14, 2019 19:36
Show Gist options
  • Select an option

  • Save ailabs-software/41405ebee656da7db5dc829c9b6051a8 to your computer and use it in GitHub Desktop.

Select an option

Save ailabs-software/41405ebee656da7db5dc829c9b6051a8 to your computer and use it in GitHub Desktop.
madonna=# EXPLAIN ANALYZE
madonna-# SELECT socialite_message.*, person_id FROM socialite_message LEFT OUTER JOIN socialite_conversation ON(id=convo_id) WHERE socialite_message.domain=131 AND active AND socialite_message.serial>0 ORDER BY serial ASC;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sort (cost=19705.89..19707.05 rows=464 width=199) (actual time=27.352..27.353 rows=6 loops=1)
Sort Key: socialite_message.serial
Sort Method: quicksort Memory: 26kB
-> Nested Loop (cost=0.85..19685.34 rows=464 width=199) (actual time=0.436..27.332 rows=6 loops=1)
-> Index Scan using socialite_conversation_active_idx on socialite_conversation (cost=0.42..172.18 rows=3271 width=32) (actual time=0.021..2.923 rows=3041 loops=1)
Index Cond: (active = true)
Filter: active
-> Index Scan using socialite_message_convo_id_idx on socialite_message (cost=0.43..5.96 rows=1 width=183) (actual time=0.008..0.008 rows=0 loops=3041)
Index Cond: (convo_id = socialite_conversation.id)
Filter: ((serial > 0) AND (domain = 131))
Rows Removed by Filter: 2
Total runtime: 27.609 ms
(12 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment