Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: add time & contention time to EXPLAIN ANALYZE. #66157

Merged
merged 1 commit into from
Jun 8, 2021
Merged

sql: add time & contention time to EXPLAIN ANALYZE. #66157

merged 1 commit into from
Jun 8, 2021

Conversation

matthewtodd
Copy link
Contributor

@matthewtodd matthewtodd commented Jun 7, 2021

The new fields are labeled KV time and KV contention time:

 > EXPLAIN ANALYZE
-> UPDATE users SET name = 'Bob Loblaw'
-> WHERE id = '32a962b7-8440-4b81-97cd-a7d7757d6eac';
                                            info
--------------------------------------------------------------------------------------------
  planning time: 353µs
  execution time: 3ms
  distribution: local
  vectorized: true
  rows read from KV: 52 (5.8 KiB)
  cumulative time spent in KV: 2ms
  maximum memory usage: 60 KiB
  network usage: 0 B (0 messages)
  cluster regions: us-east1

  • update
  │ cluster nodes: n1
  │ cluster regions: us-east1
  │ actual row count: 1
  │ table: users
  │ set: name
  │ auto commit
  │
  └── • render
      │ cluster nodes: n1
      │ cluster regions: us-east1
      │ actual row count: 1
      │ estimated row count: 0
      │
      └── • filter
          │ cluster nodes: n1
          │ cluster regions: us-east1
          │ actual row count: 1
          │ estimated row count: 0
          │ filter: id = '32a962b7-8440-4b81-97cd-a7d7757d6eac'
          │
          └── • scan
                cluster nodes: n1
                cluster regions: us-east1
                actual row count: 52
                KV time: 2ms
                KV contention time: 0µs
                KV rows read: 52
                KV bytes read: 5.8 KiB
                estimated row count: 50 (100% of the table; stats collected 3 minutes ago)
                table: users@primary
                spans: FULL SCAN
(42 rows)

Time: 4ms total (execution 4ms / network 0ms)

Resolves #64200

Release note (sql change): EXPLAIN ANALYZE output now includes, for each plan step, the total time spent waiting for KV requests as well as the total time those KV requests spent contending with other transactions.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@matthewtodd matthewtodd requested a review from a team June 7, 2021 20:40
Resolves #64200

Release note (sql change): EXPLAIN ANALYZE output now includes, for each
plan step, the total time spent waiting for KV requests as well as the
total time those KV requests spent contending with other transactions.
Copy link
Contributor

@maryliag maryliag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!
:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

@matthewtodd
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Jun 8, 2021

Build succeeded:

@craig craig bot merged commit d1c46b4 into cockroachdb:master Jun 8, 2021
@matthewtodd matthewtodd deleted the 64200-explain-analyze-kv-time branch June 23, 2021 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Surface total time and contention time for each plan step in EXPLAIN ANALYZE
3 participants