👋 how can I reproduce a realistic DB
# spicedb
w
👋 how can I reproduce a realistic DB query from spicedb? I'd like to dig into the query plan of one of the queries to see if there's anything to do to optimise it, but there's a lot of parameters and I'm struggling to figure out what would be reasonable values for them:
Copy code
sql
SELECT namespace, object_id, relation, userset_namespace, userset_object_id, userset_relation, caveat_name, caveat_context FROM relation_tuple WHERE pg_visible_in_snapshot(created_xid, $1) = $2 AND pg_visible_in_snapshot(deleted_xid, $3) = $4 AND namespace = $5 AND relation = $6 AND object_id IN ($7) AND ((userset_namespace = $8 AND userset_object_id IN ($9) AND userset_relation = $10)) LIMIT 9223372036854775807;
In particular I'm not sure what to pass for the snapshot parameters
v
I'd probably get teh XIDs from the transactions table. You can cast a string to XID like ::xid
w
The snapshot params are pg_snapshots, not xid, I don't know how to get a realistic pg_snapshot
v
my recommendation is to enable debug level logging and snap the arguments from the log, that's how we typically debug slow queries
4 Views