mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-18 09:04:19 +01:00
add metrics and implement the .stats command
This adds basic statement and connection metrics like SQLite (and
libSQL) have.
This is particularly useful to show that materialized views are working:
turso> create table t(a);
turso> insert into t(a) values (1) , (2), (3), (4), (5), (6), (7), (8), (9), (10);
turso> create materialized view v as select count(*) from t;
turso> .stats on
Stats display enabled.
turso> select count(*) from t;
┌───────────┐
│ count (*) │
├───────────┤
│ 10 │
└───────────┘
Statement Metrics:
Row Operations:
Rows read: 10
Rows written: 0
[ ... other metrics ... ]
turso> select * from v;
┌───────────┐
│ count (*) │
├───────────┤
│ 10 │
└───────────┘
Statement Metrics:
Row Operations:
Rows read: 1
Rows written: 0
[ ... other metrics ... ]
This commit is contained in:
@@ -3,8 +3,8 @@ pub mod import;
|
||||
|
||||
use args::{
|
||||
CwdArgs, DbConfigArgs, EchoArgs, ExitArgs, HeadersArgs, IndexesArgs, LoadExtensionArgs,
|
||||
NullValueArgs, OpcodesArgs, OpenArgs, OutputModeArgs, SchemaArgs, SetOutputArgs, TablesArgs,
|
||||
TimerArgs,
|
||||
NullValueArgs, OpcodesArgs, OpenArgs, OutputModeArgs, SchemaArgs, SetOutputArgs, StatsArgs,
|
||||
TablesArgs, TimerArgs,
|
||||
};
|
||||
use clap::Parser;
|
||||
use import::ImportArgs;
|
||||
@@ -78,6 +78,9 @@ pub enum Command {
|
||||
/// Print or set the current configuration for the database. Currently ignored.
|
||||
#[command(name = "dbconfig", display_name = ".dbconfig")]
|
||||
DbConfig(DbConfigArgs),
|
||||
/// Display database statistics
|
||||
#[command(name = "stats", display_name = ".stats")]
|
||||
Stats(StatsArgs),
|
||||
/// List vfs modules available
|
||||
#[command(name = "vfslist", display_name = ".vfslist")]
|
||||
ListVfs,
|
||||
|
||||
Reference in New Issue
Block a user