explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 4aUB

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 25,933.692 ↑ 1.0 12 1

Limit (cost=5,437,070.74..5,437,070.77 rows=12 width=422) (actual time=25,933.690..25,933.692 rows=12 loops=1)

2. 11.323 25,933.690 ↑ 329.5 12 1

Sort (cost=5,437,070.74..5,437,080.62 rows=3,954 width=422) (actual time=25,933.689..25,933.690 rows=12 loops=1)

  • Sort Key: ((SubPlan 1)), prd_product.prdx_created_at
  • Sort Method: top-N heapsort Memory: 31kB
3. 25.242 25,922.367 ↓ 1.0 3,975 1

Seq Scan on prd_product (cost=0.00..5,436,980.09 rows=3,954 width=422) (actual time=6.744..25,922.367 rows=3,975 loops=1)

  • Filter: (((polymorphic)::text = ANY ('{product_of_baytic,dad_deleted_product_of_baytic}'::text[])) AND (prd_status = 'published'::product_status))
  • Rows Removed by Filter: 38787
4.          

SubPlan (for Seq Scan)

5. 27.825 25,897.125 ↓ 0.0 0 3,975

Nested Loop Left Join (cost=30.94..1,374.30 rows=1 width=0) (actual time=6.515..6.515 rows=0 loops=3,975)

  • Filter: (ritusr_users_rights.ritusr_forced_access OR ritrle_roles_rights.ritrle_has_forced_access OR ((prc_purchase.prc_status = ANY ('{reserved,finished}'::prc_purchase_status[])) AND (pisu_purchase_item_of_subscription_1.usr_started_at <= to_date('2020-03-23 15:47:07'::text, 'YYYY-MM-DD HH24:MI:SS'::text)) AND ((pisu_purchase_item_of_subscription_1.usr_started_at + ('1 mon'::interval * (pisu_purchase_item_of_subscription_1.sub_duration)::double precision)) >= to_date('2020-03-23 15:47:07'::text, 'YYYY-MM-DD HH24:MI:SS'::text))) OR (prc_purchase.prc_status = ANY ('{reserved,finished}'::prc_purchase_status[])))
  • Rows Removed by Filter: 1
6. 23.850 25,865.325 ↑ 1.0 1 3,975

Nested Loop Left Join (cost=30.66..1,367.56 rows=1 width=10) (actual time=3.280..6.507 rows=1 loops=3,975)

  • Join Filter: (psi_purchase_item.prc_id__purchase = prc_purchase.prc_id)
  • Rows Removed by Join Filter: 31
7. 11.925 25,829.550 ↑ 1.0 1 3,975

Nested Loop Left Join (cost=30.66..1,365.86 rows=1 width=10) (actual time=3.271..6.498 rows=1 loops=3,975)

8. 15.900 25,809.675 ↑ 1.0 1 3,975

Nested Loop Left Join (cost=15.41..1,340.39 rows=1 width=13) (actual time=3.266..6.493 rows=1 loops=3,975)

9. 27.825 25,785.825 ↑ 1.0 1 3,975

Nested Loop Left Join (cost=0.15..1,314.92 rows=1 width=12) (actual time=3.261..6.487 rows=1 loops=3,975)

10. 25,646.700 25,646.700 ↑ 1.0 1 3,975

Seq Scan on rit_rights (cost=0.00..1,301.15 rows=1 width=4) (actual time=3.226..6.452 rows=1 loops=3,975)

  • Filter: ((product_id = prd_product.prdx_id) AND ((rit_polymorphic)::text = 'right_by_access_product'::text))
  • Rows Removed by Filter: 42809
11. 75.525 111.300 ↓ 0.0 0 3,975

Nested Loop (cost=0.15..13.76 rows=1 width=12) (actual time=0.028..0.028 rows=0 loops=3,975)

12. 35.775 35.775 ↓ 15.5 31 3,975

Seq Scan on psi_purchase_item (cost=0.00..1.39 rows=2 width=8) (actual time=0.003..0.009 rows=31 loops=3,975)

  • Filter: ((polymorphic)::text = ANY ('{purchase_item_of_salable_of_platform,purchase_item_of_subscription}'::text[]))
13. 0.000 0.000 ↓ 0.0 0 123,225

Index Only Scan using right_accesses_salable_of_platforms_purchased_items_table_pkey on right_accesses_salable_of_platforms_purchased_items_table right_accesses_salable_of_platforms_purchased_items_table_1 (cost=0.15..6.18 rows=1 width=8) (actual time=0.000..0.000 rows=0 loops=123,225)

  • Index Cond: ((psi_id = psi_purchase_item.psi_id) AND (rit_id = rit_rights.rit_id))
  • Heap Fetches: 0
14. 3.975 7.950 ↓ 0.0 0 3,975

Bitmap Heap Scan on ritusr_users_rights (cost=15.25..25.40 rows=7 width=5) (actual time=0.002..0.002 rows=0 loops=3,975)

  • Recheck Cond: (rit_rights.rit_id = rit_id__right)
15. 3.975 3.975 ↓ 0.0 0 3,975

Bitmap Index Scan on ritusr_users_rights_pkey (cost=0.00..15.25 rows=7 width=0) (actual time=0.001..0.001 rows=0 loops=3,975)

  • Index Cond: (rit_rights.rit_id = rit_id__right)
16. 3.975 7.950 ↓ 0.0 0 3,975

Bitmap Heap Scan on ritrle_roles_rights (cost=15.25..25.40 rows=7 width=5) (actual time=0.002..0.002 rows=0 loops=3,975)

  • Recheck Cond: (rit_rights.rit_id = rit_id__right)
17. 3.975 3.975 ↓ 0.0 0 3,975

Bitmap Index Scan on ritrle_roles_rights_pkey (cost=0.00..15.25 rows=7 width=0) (actual time=0.001..0.001 rows=0 loops=3,975)

  • Index Cond: (rit_rights.rit_id = rit_id__right)
18. 11.925 11.925 ↑ 1.0 31 3,975

Seq Scan on prc_purchase (cost=0.00..1.31 rows=31 width=8) (actual time=0.002..0.003 rows=31 loops=3,975)

19. 3.975 3.975 ↓ 0.0 0 3,975

Nested Loop (cost=0.28..6.71 rows=1 width=16) (actual time=0.001..0.001 rows=0 loops=3,975)

20. 0.000 0.000 ↓ 0.0 0 3,975

Index Scan using pisu_purchase_item_of_subscription_pkey on pisu_purchase_item_of_subscription pisu_purchase_item_of_subscription_1 (cost=0.14..6.16 rows=1 width=16) (actual time=0.000..0.000 rows=0 loops=3,975)

  • Index Cond: (psi_id = psi_purchase_item.psi_id)
21. 0.000 0.000 ↓ 0.0 0

Index Only Scan using psi_purchase_item_pkey on psi_purchase_item psi_purchase_item_1 (cost=0.14..0.54 rows=1 width=4) (never executed)

  • Index Cond: (psi_id = pisu_purchase_item_of_subscription_1.psi_id)
  • Heap Fetches: 0"Total runtime: 25933.776 ms