Created
December 6, 2024 02:37
-
-
Save jbranchaud/731b1a68f5cc70c4f7a9e1f5ef570836 to your computer and use it in GitHub Desktop.
Explain analyze for complex query plan in TEXT, JSON, YAML, and XML formats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"Plan": { | |
"Node Type": "Sort", | |
"Parallel Aware": false, | |
"Async Capable": false, | |
"Startup Cost": 25.77, | |
"Total Cost": 25.78, | |
"Plan Rows": 1, | |
"Plan Width": 164, | |
"Actual Startup Time": 0.120, | |
"Actual Total Time": 0.122, | |
"Actual Rows": 0, | |
"Actual Loops": 1, | |
"Sort Key": ["books.created_at DESC"], | |
"Sort Method": "quicksort", | |
"Sort Space Used": 25, | |
"Sort Space Type": "Memory", | |
"Plans": [ | |
{ | |
"Node Type": "Aggregate", | |
"Strategy": "Sorted", | |
"Partial Mode": "Simple", | |
"Parent Relationship": "Outer", | |
"Parallel Aware": false, | |
"Async Capable": false, | |
"Startup Cost": 25.73, | |
"Total Cost": 25.76, | |
"Plan Rows": 1, | |
"Plan Width": 164, | |
"Actual Startup Time": 0.091, | |
"Actual Total Time": 0.093, | |
"Actual Rows": 0, | |
"Actual Loops": 1, | |
"Group Key": ["books.id", "latest_statuses.status"], | |
"Plans": [ | |
{ | |
"Node Type": "Sort", | |
"Parent Relationship": "Outer", | |
"Parallel Aware": false, | |
"Async Capable": false, | |
"Startup Cost": 25.73, | |
"Total Cost": 25.74, | |
"Plan Rows": 1, | |
"Plan Width": 172, | |
"Actual Startup Time": 0.090, | |
"Actual Total Time": 0.092, | |
"Actual Rows": 0, | |
"Actual Loops": 1, | |
"Sort Key": ["books.id", "latest_statuses.status", "rs.created_at"], | |
"Sort Method": "quicksort", | |
"Sort Space Used": 25, | |
"Sort Space Type": "Memory", | |
"Plans": [ | |
{ | |
"Node Type": "Nested Loop", | |
"Parent Relationship": "Outer", | |
"Parallel Aware": false, | |
"Async Capable": false, | |
"Join Type": "Inner", | |
"Startup Cost": 12.94, | |
"Total Cost": 25.72, | |
"Plan Rows": 1, | |
"Plan Width": 172, | |
"Actual Startup Time": 0.056, | |
"Actual Total Time": 0.057, | |
"Actual Rows": 0, | |
"Actual Loops": 1, | |
"Inner Unique": false, | |
"Plans": [ | |
{ | |
"Node Type": "Hash Join", | |
"Parent Relationship": "Outer", | |
"Parallel Aware": false, | |
"Async Capable": false, | |
"Join Type": "Inner", | |
"Startup Cost": 12.79, | |
"Total Cost": 14.00, | |
"Plan Rows": 4, | |
"Plan Width": 140, | |
"Actual Startup Time": 0.055, | |
"Actual Total Time": 0.057, | |
"Actual Rows": 0, | |
"Actual Loops": 1, | |
"Inner Unique": true, | |
"Hash Cond": "(books.id = latest_statuses.book_id)", | |
"Plans": [ | |
{ | |
"Node Type": "Seq Scan", | |
"Parent Relationship": "Outer", | |
"Parallel Aware": false, | |
"Async Capable": false, | |
"Relation Name": "books", | |
"Alias": "books", | |
"Startup Cost": 0.00, | |
"Total Cost": 1.16, | |
"Plan Rows": 16, | |
"Plan Width": 100, | |
"Actual Startup Time": 0.013, | |
"Actual Total Time": 0.014, | |
"Actual Rows": 1, | |
"Actual Loops": 1 | |
}, | |
{ | |
"Node Type": "Hash", | |
"Parent Relationship": "Inner", | |
"Parallel Aware": false, | |
"Async Capable": false, | |
"Startup Cost": 12.74, | |
"Total Cost": 12.74, | |
"Plan Rows": 4, | |
"Plan Width": 40, | |
"Actual Startup Time": 0.030, | |
"Actual Total Time": 0.031, | |
"Actual Rows": 0, | |
"Actual Loops": 1, | |
"Hash Buckets": 1024, | |
"Original Hash Buckets": 1024, | |
"Hash Batches": 1, | |
"Original Hash Batches": 1, | |
"Peak Memory Usage": 8, | |
"Plans": [ | |
{ | |
"Node Type": "Subquery Scan", | |
"Parent Relationship": "Outer", | |
"Parallel Aware": false, | |
"Async Capable": false, | |
"Alias": "latest_statuses", | |
"Startup Cost": 12.68, | |
"Total Cost": 12.74, | |
"Plan Rows": 4, | |
"Plan Width": 40, | |
"Actual Startup Time": 0.030, | |
"Actual Total Time": 0.031, | |
"Actual Rows": 0, | |
"Actual Loops": 1, | |
"Plans": [ | |
{ | |
"Node Type": "Unique", | |
"Parent Relationship": "Subquery", | |
"Parallel Aware": false, | |
"Async Capable": false, | |
"Startup Cost": 12.68, | |
"Total Cost": 12.70, | |
"Plan Rows": 4, | |
"Plan Width": 48, | |
"Actual Startup Time": 0.030, | |
"Actual Total Time": 0.030, | |
"Actual Rows": 0, | |
"Actual Loops": 1, | |
"Plans": [ | |
{ | |
"Node Type": "Sort", | |
"Parent Relationship": "Outer", | |
"Parallel Aware": false, | |
"Async Capable": false, | |
"Startup Cost": 12.68, | |
"Total Cost": 12.69, | |
"Plan Rows": 4, | |
"Plan Width": 48, | |
"Actual Startup Time": 0.029, | |
"Actual Total Time": 0.030, | |
"Actual Rows": 0, | |
"Actual Loops": 1, | |
"Sort Key": ["reading_statuses.book_id", "reading_statuses.created_at DESC"], | |
"Sort Method": "quicksort", | |
"Sort Space Used": 25, | |
"Sort Space Type": "Memory", | |
"Plans": [ | |
{ | |
"Node Type": "Bitmap Heap Scan", | |
"Parent Relationship": "Outer", | |
"Parallel Aware": false, | |
"Async Capable": false, | |
"Relation Name": "reading_statuses", | |
"Alias": "reading_statuses", | |
"Startup Cost": 4.18, | |
"Total Cost": 12.64, | |
"Plan Rows": 4, | |
"Plan Width": 48, | |
"Actual Startup Time": 0.022, | |
"Actual Total Time": 0.022, | |
"Actual Rows": 0, | |
"Actual Loops": 1, | |
"Recheck Cond": "(user_id = 1)", | |
"Rows Removed by Index Recheck": 0, | |
"Filter": "(book_id IS NOT NULL)", | |
"Rows Removed by Filter": 0, | |
"Exact Heap Blocks": 0, | |
"Lossy Heap Blocks": 0, | |
"Plans": [ | |
{ | |
"Node Type": "Bitmap Index Scan", | |
"Parent Relationship": "Outer", | |
"Parallel Aware": false, | |
"Async Capable": false, | |
"Index Name": "index_reading_statuses_on_user_id", | |
"Startup Cost": 0.00, | |
"Total Cost": 4.18, | |
"Plan Rows": 4, | |
"Plan Width": 0, | |
"Actual Startup Time": 0.021, | |
"Actual Total Time": 0.021, | |
"Actual Rows": 0, | |
"Actual Loops": 1, | |
"Index Cond": "(user_id = 1)" | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
] | |
}, | |
{ | |
"Node Type": "Index Scan", | |
"Parent Relationship": "Inner", | |
"Parallel Aware": false, | |
"Async Capable": false, | |
"Scan Direction": "Forward", | |
"Index Name": "index_reading_statuses_on_user_id_and_book_id", | |
"Relation Name": "reading_statuses", | |
"Alias": "rs", | |
"Startup Cost": 0.15, | |
"Total Cost": 2.92, | |
"Plan Rows": 1, | |
"Plan Width": 48, | |
"Actual Startup Time": 0.000, | |
"Actual Total Time": 0.000, | |
"Actual Rows": 0, | |
"Actual Loops": 0, | |
"Index Cond": "((user_id = 1) AND (book_id = books.id))", | |
"Rows Removed by Index Recheck": 0 | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
] | |
}, | |
"Planning Time": 7.635, | |
"Triggers": [ | |
], | |
"Execution Time": 0.271 | |
} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QUERY PLAN | |
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | |
Sort (cost=25.77..25.78 rows=1 width=164) (actual time=2.684..2.706 rows=0 loops=1) | |
Sort Key: books.created_at DESC | |
Sort Method: quicksort Memory: 25kB | |
-> GroupAggregate (cost=25.73..25.76 rows=1 width=164) (actual time=1.738..1.760 rows=0 loops=1) | |
Group Key: books.id, latest_statuses.status | |
-> Sort (cost=25.73..25.74 rows=1 width=172) (actual time=1.262..1.284 rows=0 loops=1) | |
Sort Key: books.id, latest_statuses.status, rs.created_at | |
Sort Method: quicksort Memory: 25kB | |
-> Nested Loop (cost=12.94..25.72 rows=1 width=172) (actual time=1.206..1.228 rows=0 loops=1) | |
-> Hash Join (cost=12.79..14.00 rows=4 width=140) (actual time=1.205..1.227 rows=0 loops=1) | |
Hash Cond: (books.id = latest_statuses.book_id) | |
-> Seq Scan on books (cost=0.00..1.16 rows=16 width=100) (actual time=0.033..0.041 rows=1 loops=1) | |
-> Hash (cost=12.74..12.74 rows=4 width=40) (actual time=1.132..1.137 rows=0 loops=1) | |
Buckets: 1024 Batches: 1 Memory Usage: 8kB | |
-> Subquery Scan on latest_statuses (cost=12.68..12.74 rows=4 width=40) (actual time=1.131..1.132 rows=0 loops=1) | |
-> Unique (cost=12.68..12.70 rows=4 width=48) (actual time=1.131..1.131 rows=0 loops=1) | |
-> Sort (cost=12.68..12.69 rows=4 width=48) (actual time=1.130..1.131 rows=0 loops=1) | |
Sort Key: reading_statuses.book_id, reading_statuses.created_at DESC | |
Sort Method: quicksort Memory: 25kB | |
-> Bitmap Heap Scan on reading_statuses (cost=4.18..12.64 rows=4 width=48) (actual time=1.109..1.109 rows=0 loops=1) | |
Recheck Cond: (user_id = 1) | |
Filter: (book_id IS NOT NULL) | |
-> Bitmap Index Scan on index_reading_statuses_on_user_id (cost=0.00..4.18 rows=4 width=0) (actual time=0.584..0.584 rows=0 loops=1) | |
Index Cond: (user_id = 1) | |
-> Index Scan using index_reading_statuses_on_user_id_and_book_id on reading_statuses rs (cost=0.15..2.92 rows=1 width=48) (never executed) | |
Index Cond: ((user_id = 1) AND (book_id = books.id)) | |
Planning Time: 29.537 ms | |
Execution Time: 7.493 ms | |
(28 rows) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<explain xmlns="http://www.postgresql.org/2009/explain"> | |
<Query> | |
<Plan> | |
<Node-Type>Sort</Node-Type> | |
<Parallel-Aware>false</Parallel-Aware> | |
<Async-Capable>false</Async-Capable> | |
<Startup-Cost>25.77</Startup-Cost> | |
<Total-Cost>25.78</Total-Cost> | |
<Plan-Rows>1</Plan-Rows> | |
<Plan-Width>164</Plan-Width> | |
<Actual-Startup-Time>0.109</Actual-Startup-Time> | |
<Actual-Total-Time>0.113</Actual-Total-Time> | |
<Actual-Rows>0</Actual-Rows> | |
<Actual-Loops>1</Actual-Loops> | |
<Sort-Key> | |
<Item>books.created_at DESC</Item> | |
</Sort-Key> | |
<Sort-Method>quicksort</Sort-Method> | |
<Sort-Space-Used>25</Sort-Space-Used> | |
<Sort-Space-Type>Memory</Sort-Space-Type> | |
<Plans> | |
<Plan> | |
<Node-Type>Aggregate</Node-Type> | |
<Strategy>Sorted</Strategy> | |
<Partial-Mode>Simple</Partial-Mode> | |
<Parent-Relationship>Outer</Parent-Relationship> | |
<Parallel-Aware>false</Parallel-Aware> | |
<Async-Capable>false</Async-Capable> | |
<Startup-Cost>25.73</Startup-Cost> | |
<Total-Cost>25.76</Total-Cost> | |
<Plan-Rows>1</Plan-Rows> | |
<Plan-Width>164</Plan-Width> | |
<Actual-Startup-Time>0.089</Actual-Startup-Time> | |
<Actual-Total-Time>0.093</Actual-Total-Time> | |
<Actual-Rows>0</Actual-Rows> | |
<Actual-Loops>1</Actual-Loops> | |
<Group-Key> | |
<Item>books.id</Item> | |
<Item>latest_statuses.status</Item> | |
</Group-Key> | |
<Plans> | |
<Plan> | |
<Node-Type>Sort</Node-Type> | |
<Parent-Relationship>Outer</Parent-Relationship> | |
<Parallel-Aware>false</Parallel-Aware> | |
<Async-Capable>false</Async-Capable> | |
<Startup-Cost>25.73</Startup-Cost> | |
<Total-Cost>25.74</Total-Cost> | |
<Plan-Rows>1</Plan-Rows> | |
<Plan-Width>172</Plan-Width> | |
<Actual-Startup-Time>0.088</Actual-Startup-Time> | |
<Actual-Total-Time>0.092</Actual-Total-Time> | |
<Actual-Rows>0</Actual-Rows> | |
<Actual-Loops>1</Actual-Loops> | |
<Sort-Key> | |
<Item>books.id</Item> | |
<Item>latest_statuses.status</Item> | |
<Item>rs.created_at</Item> | |
</Sort-Key> | |
<Sort-Method>quicksort</Sort-Method> | |
<Sort-Space-Used>25</Sort-Space-Used> | |
<Sort-Space-Type>Memory</Sort-Space-Type> | |
<Plans> | |
<Plan> | |
<Node-Type>Nested Loop</Node-Type> | |
<Parent-Relationship>Outer</Parent-Relationship> | |
<Parallel-Aware>false</Parallel-Aware> | |
<Async-Capable>false</Async-Capable> | |
<Join-Type>Inner</Join-Type> | |
<Startup-Cost>12.94</Startup-Cost> | |
<Total-Cost>25.72</Total-Cost> | |
<Plan-Rows>1</Plan-Rows> | |
<Plan-Width>172</Plan-Width> | |
<Actual-Startup-Time>0.061</Actual-Startup-Time> | |
<Actual-Total-Time>0.065</Actual-Total-Time> | |
<Actual-Rows>0</Actual-Rows> | |
<Actual-Loops>1</Actual-Loops> | |
<Inner-Unique>false</Inner-Unique> | |
<Plans> | |
<Plan> | |
<Node-Type>Hash Join</Node-Type> | |
<Parent-Relationship>Outer</Parent-Relationship> | |
<Parallel-Aware>false</Parallel-Aware> | |
<Async-Capable>false</Async-Capable> | |
<Join-Type>Inner</Join-Type> | |
<Startup-Cost>12.79</Startup-Cost> | |
<Total-Cost>14.00</Total-Cost> | |
<Plan-Rows>4</Plan-Rows> | |
<Plan-Width>140</Plan-Width> | |
<Actual-Startup-Time>0.061</Actual-Startup-Time> | |
<Actual-Total-Time>0.064</Actual-Total-Time> | |
<Actual-Rows>0</Actual-Rows> | |
<Actual-Loops>1</Actual-Loops> | |
<Inner-Unique>true</Inner-Unique> | |
<Hash-Cond>(books.id = latest_statuses.book_id)</Hash-Cond> | |
<Plans> | |
<Plan> | |
<Node-Type>Seq Scan</Node-Type> | |
<Parent-Relationship>Outer</Parent-Relationship> | |
<Parallel-Aware>false</Parallel-Aware> | |
<Async-Capable>false</Async-Capable> | |
<Relation-Name>books</Relation-Name> | |
<Alias>books</Alias> | |
<Startup-Cost>0.00</Startup-Cost> | |
<Total-Cost>1.16</Total-Cost> | |
<Plan-Rows>16</Plan-Rows> | |
<Plan-Width>100</Plan-Width> | |
<Actual-Startup-Time>0.015</Actual-Startup-Time> | |
<Actual-Total-Time>0.015</Actual-Total-Time> | |
<Actual-Rows>1</Actual-Rows> | |
<Actual-Loops>1</Actual-Loops> | |
</Plan> | |
<Plan> | |
<Node-Type>Hash</Node-Type> | |
<Parent-Relationship>Inner</Parent-Relationship> | |
<Parallel-Aware>false</Parallel-Aware> | |
<Async-Capable>false</Async-Capable> | |
<Startup-Cost>12.74</Startup-Cost> | |
<Total-Cost>12.74</Total-Cost> | |
<Plan-Rows>4</Plan-Rows> | |
<Plan-Width>40</Plan-Width> | |
<Actual-Startup-Time>0.031</Actual-Startup-Time> | |
<Actual-Total-Time>0.034</Actual-Total-Time> | |
<Actual-Rows>0</Actual-Rows> | |
<Actual-Loops>1</Actual-Loops> | |
<Hash-Buckets>1024</Hash-Buckets> | |
<Original-Hash-Buckets>1024</Original-Hash-Buckets> | |
<Hash-Batches>1</Hash-Batches> | |
<Original-Hash-Batches>1</Original-Hash-Batches> | |
<Peak-Memory-Usage>8</Peak-Memory-Usage> | |
<Plans> | |
<Plan> | |
<Node-Type>Subquery Scan</Node-Type> | |
<Parent-Relationship>Outer</Parent-Relationship> | |
<Parallel-Aware>false</Parallel-Aware> | |
<Async-Capable>false</Async-Capable> | |
<Alias>latest_statuses</Alias> | |
<Startup-Cost>12.68</Startup-Cost> | |
<Total-Cost>12.74</Total-Cost> | |
<Plan-Rows>4</Plan-Rows> | |
<Plan-Width>40</Plan-Width> | |
<Actual-Startup-Time>0.031</Actual-Startup-Time> | |
<Actual-Total-Time>0.031</Actual-Total-Time> | |
<Actual-Rows>0</Actual-Rows> | |
<Actual-Loops>1</Actual-Loops> | |
<Plans> | |
<Plan> | |
<Node-Type>Unique</Node-Type> | |
<Parent-Relationship>Subquery</Parent-Relationship> | |
<Parallel-Aware>false</Parallel-Aware> | |
<Async-Capable>false</Async-Capable> | |
<Startup-Cost>12.68</Startup-Cost> | |
<Total-Cost>12.70</Total-Cost> | |
<Plan-Rows>4</Plan-Rows> | |
<Plan-Width>48</Plan-Width> | |
<Actual-Startup-Time>0.030</Actual-Startup-Time> | |
<Actual-Total-Time>0.030</Actual-Total-Time> | |
<Actual-Rows>0</Actual-Rows> | |
<Actual-Loops>1</Actual-Loops> | |
<Plans> | |
<Plan> | |
<Node-Type>Sort</Node-Type> | |
<Parent-Relationship>Outer</Parent-Relationship> | |
<Parallel-Aware>false</Parallel-Aware> | |
<Async-Capable>false</Async-Capable> | |
<Startup-Cost>12.68</Startup-Cost> | |
<Total-Cost>12.69</Total-Cost> | |
<Plan-Rows>4</Plan-Rows> | |
<Plan-Width>48</Plan-Width> | |
<Actual-Startup-Time>0.030</Actual-Startup-Time> | |
<Actual-Total-Time>0.030</Actual-Total-Time> | |
<Actual-Rows>0</Actual-Rows> | |
<Actual-Loops>1</Actual-Loops> | |
<Sort-Key> | |
<Item>reading_statuses.book_id</Item> | |
<Item>reading_statuses.created_at DESC</Item> | |
</Sort-Key> | |
<Sort-Method>quicksort</Sort-Method> | |
<Sort-Space-Used>25</Sort-Space-Used> | |
<Sort-Space-Type>Memory</Sort-Space-Type> | |
<Plans> | |
<Plan> | |
<Node-Type>Bitmap Heap Scan</Node-Type> | |
<Parent-Relationship>Outer</Parent-Relationship> | |
<Parallel-Aware>false</Parallel-Aware> | |
<Async-Capable>false</Async-Capable> | |
<Relation-Name>reading_statuses</Relation-Name> | |
<Alias>reading_statuses</Alias> | |
<Startup-Cost>4.18</Startup-Cost> | |
<Total-Cost>12.64</Total-Cost> | |
<Plan-Rows>4</Plan-Rows> | |
<Plan-Width>48</Plan-Width> | |
<Actual-Startup-Time>0.021</Actual-Startup-Time> | |
<Actual-Total-Time>0.021</Actual-Total-Time> | |
<Actual-Rows>0</Actual-Rows> | |
<Actual-Loops>1</Actual-Loops> | |
<Recheck-Cond>(user_id = 1)</Recheck-Cond> | |
<Rows-Removed-by-Index-Recheck>0</Rows-Removed-by-Index-Recheck> | |
<Filter>(book_id IS NOT NULL)</Filter> | |
<Rows-Removed-by-Filter>0</Rows-Removed-by-Filter> | |
<Exact-Heap-Blocks>0</Exact-Heap-Blocks> | |
<Lossy-Heap-Blocks>0</Lossy-Heap-Blocks> | |
<Plans> | |
<Plan> | |
<Node-Type>Bitmap Index Scan</Node-Type> | |
<Parent-Relationship>Outer</Parent-Relationship> | |
<Parallel-Aware>false</Parallel-Aware> | |
<Async-Capable>false</Async-Capable> | |
<Index-Name>index_reading_statuses_on_user_id</Index-Name> | |
<Startup-Cost>0.00</Startup-Cost> | |
<Total-Cost>4.18</Total-Cost> | |
<Plan-Rows>4</Plan-Rows> | |
<Plan-Width>0</Plan-Width> | |
<Actual-Startup-Time>0.020</Actual-Startup-Time> | |
<Actual-Total-Time>0.020</Actual-Total-Time> | |
<Actual-Rows>0</Actual-Rows> | |
<Actual-Loops>1</Actual-Loops> | |
<Index-Cond>(user_id = 1)</Index-Cond> | |
</Plan> | |
</Plans> | |
</Plan> | |
</Plans> | |
</Plan> | |
</Plans> | |
</Plan> | |
</Plans> | |
</Plan> | |
</Plans> | |
</Plan> | |
</Plans> | |
</Plan> | |
<Plan> | |
<Node-Type>Index Scan</Node-Type> | |
<Parent-Relationship>Inner</Parent-Relationship> | |
<Parallel-Aware>false</Parallel-Aware> | |
<Async-Capable>false</Async-Capable> | |
<Scan-Direction>Forward</Scan-Direction> | |
<Index-Name>index_reading_statuses_on_user_id_and_book_id</Index-Name> | |
<Relation-Name>reading_statuses</Relation-Name> | |
<Alias>rs</Alias> | |
<Startup-Cost>0.15</Startup-Cost> | |
<Total-Cost>2.92</Total-Cost> | |
<Plan-Rows>1</Plan-Rows> | |
<Plan-Width>48</Plan-Width> | |
<Actual-Startup-Time>0.000</Actual-Startup-Time> | |
<Actual-Total-Time>0.000</Actual-Total-Time> | |
<Actual-Rows>0</Actual-Rows> | |
<Actual-Loops>0</Actual-Loops> | |
<Index-Cond>((user_id = 1) AND (book_id = books.id))</Index-Cond> | |
<Rows-Removed-by-Index-Recheck>0</Rows-Removed-by-Index-Recheck> | |
</Plan> | |
</Plans> | |
</Plan> | |
</Plans> | |
</Plan> | |
</Plans> | |
</Plan> | |
</Plans> | |
</Plan> | |
<Planning-Time>7.541</Planning-Time> | |
<Triggers> | |
</Triggers> | |
<Execution-Time>0.251</Execution-Time> | |
</Query> | |
</explain> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Plan: | |
Node Type: "Sort" | |
Parallel Aware: false | |
Async Capable: false | |
Startup Cost: 25.77 | |
Total Cost: 25.78 | |
Plan Rows: 1 | |
Plan Width: 164 | |
Actual Startup Time: 0.119 | |
Actual Total Time: 0.121 | |
Actual Rows: 0 | |
Actual Loops: 1 | |
Sort Key: | |
- "books.created_at DESC" | |
Sort Method: "quicksort" | |
Sort Space Used: 25 | |
Sort Space Type: "Memory" | |
Plans: | |
- Node Type: "Aggregate" | |
Strategy: "Sorted" | |
Partial Mode: "Simple" | |
Parent Relationship: "Outer" | |
Parallel Aware: false | |
Async Capable: false | |
Startup Cost: 25.73 | |
Total Cost: 25.76 | |
Plan Rows: 1 | |
Plan Width: 164 | |
Actual Startup Time: 0.099 | |
Actual Total Time: 0.101 | |
Actual Rows: 0 | |
Actual Loops: 1 | |
Group Key: | |
- "books.id" | |
- "latest_statuses.status" | |
Plans: | |
- Node Type: "Sort" | |
Parent Relationship: "Outer" | |
Parallel Aware: false | |
Async Capable: false | |
Startup Cost: 25.73 | |
Total Cost: 25.74 | |
Plan Rows: 1 | |
Plan Width: 172 | |
Actual Startup Time: 0.098 | |
Actual Total Time: 0.100 | |
Actual Rows: 0 | |
Actual Loops: 1 | |
Sort Key: | |
- "books.id" | |
- "latest_statuses.status" | |
- "rs.created_at" | |
Sort Method: "quicksort" | |
Sort Space Used: 25 | |
Sort Space Type: "Memory" | |
Plans: | |
- Node Type: "Nested Loop" | |
Parent Relationship: "Outer" | |
Parallel Aware: false | |
Async Capable: false | |
Join Type: "Inner" | |
Startup Cost: 12.94 | |
Total Cost: 25.72 | |
Plan Rows: 1 | |
Plan Width: 172 | |
Actual Startup Time: 0.064 | |
Actual Total Time: 0.066 | |
Actual Rows: 0 | |
Actual Loops: 1 | |
Inner Unique: false | |
Plans: | |
- Node Type: "Hash Join" | |
Parent Relationship: "Outer" | |
Parallel Aware: false | |
Async Capable: false | |
Join Type: "Inner" | |
Startup Cost: 12.79 | |
Total Cost: 14.00 | |
Plan Rows: 4 | |
Plan Width: 140 | |
Actual Startup Time: 0.063 | |
Actual Total Time: 0.065 | |
Actual Rows: 0 | |
Actual Loops: 1 | |
Inner Unique: true | |
Hash Cond: "(books.id = latest_statuses.book_id)" | |
Plans: | |
- Node Type: "Seq Scan" | |
Parent Relationship: "Outer" | |
Parallel Aware: false | |
Async Capable: false | |
Relation Name: "books" | |
Alias: "books" | |
Startup Cost: 0.00 | |
Total Cost: 1.16 | |
Plan Rows: 16 | |
Plan Width: 100 | |
Actual Startup Time: 0.014 | |
Actual Total Time: 0.014 | |
Actual Rows: 1 | |
Actual Loops: 1 | |
- Node Type: "Hash" | |
Parent Relationship: "Inner" | |
Parallel Aware: false | |
Async Capable: false | |
Startup Cost: 12.74 | |
Total Cost: 12.74 | |
Plan Rows: 4 | |
Plan Width: 40 | |
Actual Startup Time: 0.038 | |
Actual Total Time: 0.039 | |
Actual Rows: 0 | |
Actual Loops: 1 | |
Hash Buckets: 1024 | |
Original Hash Buckets: 1024 | |
Hash Batches: 1 | |
Original Hash Batches: 1 | |
Peak Memory Usage: 8 | |
Plans: | |
- Node Type: "Subquery Scan" | |
Parent Relationship: "Outer" | |
Parallel Aware: false | |
Async Capable: false | |
Alias: "latest_statuses" | |
Startup Cost: 12.68 | |
Total Cost: 12.74 | |
Plan Rows: 4 | |
Plan Width: 40 | |
Actual Startup Time: 0.038 | |
Actual Total Time: 0.039 | |
Actual Rows: 0 | |
Actual Loops: 1 | |
Plans: | |
- Node Type: "Unique" | |
Parent Relationship: "Subquery" | |
Parallel Aware: false | |
Async Capable: false | |
Startup Cost: 12.68 | |
Total Cost: 12.70 | |
Plan Rows: 4 | |
Plan Width: 48 | |
Actual Startup Time: 0.038 | |
Actual Total Time: 0.038 | |
Actual Rows: 0 | |
Actual Loops: 1 | |
Plans: | |
- Node Type: "Sort" | |
Parent Relationship: "Outer" | |
Parallel Aware: false | |
Async Capable: false | |
Startup Cost: 12.68 | |
Total Cost: 12.69 | |
Plan Rows: 4 | |
Plan Width: 48 | |
Actual Startup Time: 0.037 | |
Actual Total Time: 0.038 | |
Actual Rows: 0 | |
Actual Loops: 1 | |
Sort Key: | |
- "reading_statuses.book_id" | |
- "reading_statuses.created_at DESC" | |
Sort Method: "quicksort" | |
Sort Space Used: 25 | |
Sort Space Type: "Memory" | |
Plans: | |
- Node Type: "Bitmap Heap Scan" | |
Parent Relationship: "Outer" | |
Parallel Aware: false | |
Async Capable: false | |
Relation Name: "reading_statuses" | |
Alias: "reading_statuses" | |
Startup Cost: 4.18 | |
Total Cost: 12.64 | |
Plan Rows: 4 | |
Plan Width: 48 | |
Actual Startup Time: 0.031 | |
Actual Total Time: 0.031 | |
Actual Rows: 0 | |
Actual Loops: 1 | |
Recheck Cond: "(user_id = 1)" | |
Rows Removed by Index Recheck: 0 | |
Filter: "(book_id IS NOT NULL)" | |
Rows Removed by Filter: 0 | |
Exact Heap Blocks: 0 | |
Lossy Heap Blocks: 0 | |
Plans: | |
- Node Type: "Bitmap Index Scan" | |
Parent Relationship: "Outer" | |
Parallel Aware: false | |
Async Capable: false | |
Index Name: "index_reading_statuses_on_user_id" | |
Startup Cost: 0.00 | |
Total Cost: 4.18 | |
Plan Rows: 4 | |
Plan Width: 0 | |
Actual Startup Time: 0.029 | |
Actual Total Time: 0.029 | |
Actual Rows: 0 | |
Actual Loops: 1 | |
Index Cond: "(user_id = 1)" | |
- Node Type: "Index Scan" | |
Parent Relationship: "Inner" | |
Parallel Aware: false | |
Async Capable: false | |
Scan Direction: "Forward" | |
Index Name: "index_reading_statuses_on_user_id_and_book_id" | |
Relation Name: "reading_statuses" | |
Alias: "rs" | |
Startup Cost: 0.15 | |
Total Cost: 2.92 | |
Plan Rows: 1 | |
Plan Width: 48 | |
Actual Startup Time: 0.000 | |
Actual Total Time: 0.000 | |
Actual Rows: 0 | |
Actual Loops: 0 | |
Index Cond: "((user_id = 1) AND (book_id = books.id))" | |
Rows Removed by Index Recheck: 0 | |
Planning Time: 7.472 | |
Triggers: | |
Execution Time: 0.272 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment