tursodatabase / turso-cli

Command line interface to Turso.
https://turso.tech
MIT License
215 stars 35 forks source link

Measure usage with `turso db inspect` #275

Closed CodingDoug closed 1 year ago

CodingDoug commented 1 year ago

This is derived from work that was already started in #273.

Some suggestions to make that output more insightful:

  1. Show the total space used - this is the bottom line for billing and likely the first thing the user wants to know.
  2. Indicate which items are tables or indexes
  3. Sort the list by a. size descending b. name

So it could be something like this (based on what #273 shows):

Total size: xx KB

TYPE   NAME                                  SIZE (KB)
table  users                                 68
index  some_index_1                          8
table  _litestream_seq                       4
table  _litestream_lock                      4
table  libsql_wasm_func_table                4
index  sqlite_autoindex_schema_migrations_1  4
table  sqlite_schema                         4

The contents of sqlite_schema help discern between tables and indexes.

The total size might want to change units if it gets very large.

glommer commented 1 year ago

Other things that I'd like to see:

CodingDoug commented 1 year ago

Is the cost of storage the same in each location? If so, there can just be a multiplier for number of instances. If not, this gets a lot more complex and we have to break down the per-location costs to make it clear where costs are going.

glommer commented 1 year ago

storage costs the same in all locations, so for now we can just multiply. In the future we want to choose which tables get replicated to which locations, so not always will the multiplier work.