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 row count estimates to show tables #48755

Closed
awoods187 opened this issue May 12, 2020 · 1 comment · Fixed by #52203
Closed

sql: add row count estimates to show tables #48755

awoods187 opened this issue May 12, 2020 · 1 comment · Fixed by #52203
Labels
A-sql-ui Why is my query slow? A-webui-queryperf C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) C-performance Perf of queries or internals. Solution not expected to change functional behavior.

Comments

@awoods187
Copy link
Contributor

It's important for developers to know the approximate table size in rows when optimizing query performance. Currently, you can't see table row size estimates in CockroachDB without running something like:

 select count (*) from rides;
  count
---------
    500
(1 row)

Time: 2.258ms

We should add estimated row counts to show tables and to the ERD proposed in #48418.

root@127.0.0.1:52983/movr> show tables;
  schema_name |         table_name         | type | rows
--------------+----------------------------+--------
  public      | promo_codes                | table | 1000
  public      | rides                      | table | 500
  public      | user_promo_codes           | table | 0
  public      | users                      | table | 50
  public      | vehicle_location_histories | table | 1000
  public      | vehicles                   | table | 15
(6 rows)

To avoid running the equivalent of select count (*) everytime we run SHOW TABLES we could use the last value collected from automatic statistics.

@blathers-crl
Copy link

blathers-crl bot commented May 12, 2020

Hi @awoods187, please add a C-ategory label to your issue. Check out the label system docs.

While you're here, please consider adding an A- label to help keep our repository tidy.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

@awoods187 awoods187 added the C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) label May 12, 2020
@awoods187 awoods187 added A-webui-queryperf C-performance Perf of queries or internals. Solution not expected to change functional behavior. labels May 12, 2020
@awoods187 awoods187 added the A-sql-ui Why is my query slow? label May 27, 2020
@craig craig bot closed this as completed in 82d1347 Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-ui Why is my query slow? A-webui-queryperf C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) C-performance Perf of queries or internals. Solution not expected to change functional behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant