explain.depesz.com

PostgreSQL's explain analyze made readable

Result: bctF

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 1.195 ↓ 959.0 959 1

Nested Loop Left Join (cost=1.14..77.24 rows=1 width=92) (actual time=0.020..1.195 rows=959 loops=1)

  • Filter: (((COALESCE(rappi_credit_transactions.ends_at, rappi_credit_restrictions.ends_at) IS NULL) OR (COALESCE(rappi_credit_transactions.ends_at, rappi_credit_restrictions.ends_at) > now())) AND ((rappi_credit_restrictions.starts_at IS NULL) OR (rappi_credit_restrictions.starts_at < now())) AND ((rappi_credit_restrictions.ends_at IS NULL) OR (rappi_credit_restrictions.ends_at > now())))
  • Rows Removed by Filter: 45
  • Hash Cond: (rappi_credit_transactions.rappi_credit_restriction_id = rappi_credit_restrictions.id)
  • Filter: ((((rappi_credit_transactions.state)::text = 'paid'::text) AND (rappi_credits.application_user_id = 131459676) AND ((rappi_credit_transactions.starts_at IS NULL) OR (rappi_credit_transactions.starts_at < '2019-06-06 10:11:08.712495'::timestamp without time zone)) AND (rappi_credit_transactions.ends_at IS NULL)) OR ((rappi_credit_restrictions.ends_at > '2019-06-06 10:11:08.712495'::timestamp without time zone) AND ((rappi_credit_restrictions.starts_at IS NULL) OR (rappi_credit_restrictions.starts_at < '2019-06-06 10:11:08.712495'::timestamp without time zone)) AND ((rappi_credit_restrictions.ends_at IS NULL) OR (rappi_credit_restrictions.ends_at > '2019-06-06 10:11:08.712495'::timestamp without time zone))))
  • Rows Removed by Filter: 851963
2. 0.136 0.648 ↓ 334.7 1,004 1

Nested Loop (cost=0.84..76.19 rows=3 width=60) (actual time=0.018..0.648 rows=1,004 loops=1)

3. 0.008 0.008 ↑ 1.0 1 1

Index Scan using rappi_credits_application_user_id_index on rappi_credits (cost=0.42..8.44 rows=1 width=5) (actual time=0.007..0.008 rows=1 loops=1)

  • Index Cond: (application_user_id = 131459676)
4. 0.000 0.504 ↓ 125.5 1,004 1

Index Scan using rappi_credit_transactions_rappi_credit_id_index on rappi_credit_transactions (cost=0.42..67.67 rows=8 width=59) (actual time=0.011..0.504 rows=1,004 loops=1)

  • Index Cond: (rappi_credit_id = rappi_credits.id)
  • Filter: (((state)::text = 'paid'::text) AND ((starts_at IS NULL) OR (starts_at < now())))
5. 892.600 892.600 ↓ 1.4 7,896 1

Rows Removed by Filter: 621Hash Left Join (cost=8,757.25..82,960.02 rows=5,705 width=92) (actual time=75.668..892.600 rows=7,896 loops=1)

6. 422.386 683.714 ↑ 1.0 859,859 1

Hash Join (cost=5,578.77..56,360.42 rows=859,859 width=68) (actual time=47.785..683.714 rows=859,859 loops=1)

  • Hash Cond: (rappi_credit_transactions.rappi_credit_id = rappi_credits.id)
7. 214.113 214.113 ↑ 1.0 859,859 1

Seq Scan on rappi_credit_transactions (cost=0.00..19,743.59 rows=859,859 width=59) (actual time=0.005..214.113 rows=859,859 loops=1)

8. 25.129 47.215 ↑ 1.0 151,723 1

Hash (cost=2,941.23..2,941.23 rows=151,723 width=13) (actual time=47.215..47.215 rows=151,723 loops=1)

  • Buckets: 131072 Batches: 4 Memory Usage: 2810kB
9. 22.086 22.086 ↑ 1.0 151,723 1

Seq Scan on rappi_credits (cost=0.00..2,941.23 rows=151,723 width=13) (actual time=0.020..22.086 rows=151,723 loops=1)

10. 9.155 27.120 ↓ 1.0 63,492 1

Hash (cost=2,384.88..2,384.88 rows=63,488 width=20) (actual time=27.120..27.120 rows=63,492 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 3088kB
11. 17.965 17.965 ↓ 1.0 63,492 1

Seq Scan on rappi_credit_restrictions (cost=0.00..2,384.88 rows=63,488 width=20) (actual time=0.004..17.965 rows=63,492 loops=1)

12. 0.000 0.000 ↓ 0.0 0 1,004

Index Scan using rappi_credit_restrictions_pkey on rappi_credit_restrictions (cost=0.29..0.33 rows=1 width=20) (actual time=0.000..0.000 rows=0 loops=1,004)

  • Index Cond: (id = rappi_credit_transactions.rappi_credit_restriction_id)
Planning time : 0.358 ms
Execution time : 1.285 ms