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

feat: implement query \timing command for local repl #1903

Merged
merged 4 commits into from
Oct 11, 2023
Merged

Conversation

gruuya
Copy link
Contributor

@gruuya gruuya commented Oct 11, 2023

Implement a \timing command in analogy with the one in psql:

> \timing
Timing is on
> select count(*) from lineitem;
┌─────────────────┐
│ COUNT(UInt8(1)) │
│              ── │
│           Int64 │
╞═════════════════╡
│        29999795 │
└─────────────────┘
Time: 0.067s

Comment on lines +41 to +42
#[clap(long, default_value = "false", hide = true)]
pub timing: bool,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This could also not be hidden, but I didn't feel like it was worth extending the existing cli args just with this.

@@ -226,6 +233,7 @@ impl LocalSession {
self.opts.mode,
self.opts.max_width,
self.opts.max_rows,
now,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This means only ExecutionResult::Query statements will be timed, so for now no DDL/DML timing info.

Comment on lines -33 to -35
utils.get_customer_ds()
utils.get_orders_ds()

Copy link
Contributor

Choose a reason for hiding this comment

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

thank you for fixing this!

Copy link
Contributor

@vrongmeal vrongmeal left a comment

Choose a reason for hiding this comment

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

Looks good to me! Just a minor change to add time units.

crates/glaredb/src/local.rs Outdated Show resolved Hide resolved
@tychoish tychoish changed the title Implement query \timing command feat: implement query \timing command for local repl Oct 11, 2023
Copy link
Contributor

@tychoish tychoish left a comment

Choose a reason for hiding this comment

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

I like it! Fixed up the commit message, otherwise seems good.

@gruuya gruuya merged commit d179be2 into main Oct 11, 2023
@gruuya gruuya deleted the query-timing-command branch October 11, 2023 13:56
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.

3 participants