daily pastebin goal
76%
SHARE
TWEET

Untitled

a guest Jan 15th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. postal=> EXPLAIN ANALYZE SELECT uuid from core_job where customer_id = 778449 and delivery_type = 'api' and date_created <= '2019-01-14 08:00:00+00' order by date_created desc limit 20;
  2.                                                                              QUERY PLAN                                                                              
  3. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
  4.  Limit  (cost=0.57..2522.42 rows=20 width=45) (actual time=0.023..0.073 rows=20 loops=1)
  5.    ->  Index Scan Backward using core_job_customer_id_date_created on core_job  (cost=0.57..892358.66 rows=7077 width=45) (actual time=0.021..0.064 rows=20 loops=1)
  6.          Index Cond: ((customer_id = 778449) AND (date_created <= '2019-01-14 08:00:00+00'::timestamp with time zone))
  7.          Filter: ((delivery_type)::text = 'api'::text)
  8.  Planning time: 1.527 ms
  9.  Execution time: 0.100 ms
  10. (6 rows)
  11.  
  12. postal=> EXPLAIN ANALYZE SELECT uuid from core_job where customer_id = 778449 and delivery_type = 'api' and date_created <= '2019-01-14 08:00:00+00'and id < 118938209 order by date_created desc, id desc limit 20;
  13.                                                                                QUERY PLAN                                                                                
  14. -------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  15.  Limit  (cost=686241.00..686241.05 rows=20 width=49) (actual time=1852.084..1852.096 rows=20 loops=1)
  16.    ->  Sort  (cost=686241.00..686254.49 rows=5394 width=49) (actual time=1852.083..1852.088 rows=20 loops=1)
  17.          Sort Key: date_created DESC, id DESC
  18.          Sort Method: top-N heapsort  Memory: 27kB
  19.          ->  Index Scan using core_job_customer_id_date_created on core_job  (cost=0.57..686097.47 rows=5394 width=49) (actual time=0.087..1655.112 rows=272862 loops=1)
  20.                Index Cond: ((customer_id = 778449) AND (date_created <= '2019-01-14 08:00:00+00'::timestamp with time zone))
  21.                Filter: ((id < 118938209) AND ((delivery_type)::text = 'api'::text))
  22.                Rows Removed by Filter: 39
  23.  Planning time: 2.568 ms
  24.  Execution time: 1852.139 ms
  25. (10 rows)
  26.  
  27. postal=> EXPLAIN ANALYZE SELECT uuid from core_job where customer_id = 778449 and delivery_type = 'api' and id < 118938209 order by id desc limit 20;
  28.                                                                      QUERY PLAN                                                                      
  29. -----------------------------------------------------------------------------------------------------------------------------------------------------
  30.  Limit  (cost=0.57..43845.28 rows=20 width=41) (actual time=1.533..467.689 rows=20 loops=1)
  31.    ->  Index Scan Backward using core_job_pkey on core_job  (cost=0.57..11855611.66 rows=5408 width=41) (actual time=1.531..467.662 rows=20 loops=1)
  32.          Index Cond: (id < 118938209)
  33.          Filter: ((customer_id = 778449) AND ((delivery_type)::text = 'api'::text))
  34.          Rows Removed by Filter: 23070
  35.  Planning time: 0.240 ms
  36.  Execution time: 467.741 ms
  37. (7 rows)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top