Skip to content

Commit

Permalink
Propagate mem usage for lookup join to 21.2 (cockroachdb#14623)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephanie Bodoff authored Jul 25, 2022
1 parent f52053f commit e9ec482
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions v21.2/explain-analyze.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,51 @@ For example, the following `EXPLAIN ANALYZE` statement executes a simple query a
Time: 694ms total (execution 694ms / network 0ms)
~~~

If you perform a join, the estimated max memory allocation is also reported for the join. For example:

{% include_cached copy-clipboard.html %}
~~~ sql
EXPLAIN ANALYZE SELECT * FROM vehicles JOIN rides ON rides.vehicle_id = vehicles.id and rides.city = vehicles.city limit 100;
~~~
~~~
info
-----------------------------------------------------
planning time: 1ms
execution time: 18ms
distribution: full
vectorized: true
rows read from KV: 3,173 (543 KiB)
cumulative time spent in KV: 37ms
maximum memory usage: 820 KiB
network usage: 3.3 KiB (2 messages)
regions: us-east1
• limit
│ nodes: n1
│ regions: us-east1
│ actual row count: 100
│ estimated row count: 100
│ count: 100
└── • lookup join
│ nodes: n1, n2, n3
│ regions: us-east1
│ actual row count: 194
│ KV time: 31ms
│ KV contention time: 0µs
│ KV rows read: 173
│ KV bytes read: 25 KiB
│ estimated max memory allocated: 300 KiB
│ estimated row count: 13,837
│ table: vehicles@vehicles_pkey
│ equality: (city, vehicle_id) = (city,id)
│ equality cols are key
└── • scan
...
(41 rows)
~~~

### `EXPLAIN ANALYZE (DISTSQL)`

Use `EXPLAIN ANALYZE (DISTSQL)` to execute a query, display the physical statement plan with execution statistics, and generate a link to a graphical DistSQL statement plan.
Expand Down

0 comments on commit e9ec482

Please sign in to comment.