clockworklabs / SpacetimeDB

Multiplayer at the speed of light
https://spacetimedb.com
Other
4.12k stars 100 forks source link

Slow query log per module #1159

Open joshua-spacetime opened 3 weeks ago

joshua-spacetime commented 3 weeks ago

https://github.com/clockworklabs/SpacetimeDB/issues/1071 captures slow queries through the SpacetimeDB server logs. Now we should give users the same insight with a slow query system table. They should be able to configure the 3 thresholds (subscriptions, ad hoc, incremental update) in the same way we can do now.

Something worth noting is that queries are executed in read-only transactions, but writing to a table requires a mutable transaction. This may require making read-only transactions upgradable. Basically the opposite direction of #1157.

joshua-spacetime commented 2 weeks ago
The schema of the slow query log Name Type Description
query string text of the slow query
workload enum subscription, incremental update, ad hoc
duration u64 duration of the query in milliseconds
identity Identity calling identity for this query