SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

Print back the # of rows affected (ins, upd, del, scanned) with timings

Open mamcx opened this issue 10 months ago • 0 comments

Description of Changes

Closes #2430.

API and ABI breaking changes

It change the returning json for sql route (spacetimedb::json::client_api::StmtResultJson), with added field for stats.

Expected complexity level and risk

1

Testing

  • [x] Added test that confirm the number of stats for ins, del, upd
  • [x] Manual testing of the cli output using the module keynote-benchmarks
🪐quickstart>delete from position;
(0 rows) [scan: 2000000, del: 1000000, server: 3.49s, client: 3.50s]

🪐quickstart>select * from position;
 id | x | y | z
----+---+---+---
(0 rows) [server: 1.98ms, client: 9.42ms]

🪐quickstart>delete from position;
(0 rows) [server: 1.29ms, client: 8.32ms]

🪐quickstart>INSERT INTO position (id, x, y, z) VALUES (1000011, 10.0, 20.0, 30.0);
(0 rows) [ins: 1, server: 1.99ms, client: 7.02ms]

🪐quickstart>select * from position;
 id      | x  | y  | z
---------+----+----+----
 1000011 | 10 | 20 | 30
(1 row) [scan: 3, server: 1.41ms, client: 7.07ms]

🪐quickstart>update position set x = 1.0;
(0 rows) [scan: 2, upd: 1, server: 3.08ms, client: 8.96ms]

mamcx avatar Mar 13 '25 20:03 mamcx