williamdclt
08/02/2022, 3:21 PMschema write
where I removed 3 permissions. I was expecting this to be instant, but it took ~3min, during which i observed a huge increased load on my (Postgres) database due to this query:
SELECT namespace, object_id, relation, userset_namespace, userset_object_id, userset_relation FROM relation_tuple WHERE created_transaction <= $1 AND (deleted_transaction = $2 OR deleted_transaction > $3) AND namespace = $4 AND relation = $5 LIMIT ?
How comes removing a permission requires a DB query? How comes it is so expensive? My DB CPU jumped from ~10% to 50-60% for 3 minutes: this was my staging environment, I'm concerned about deploying this to production :/jzelinskie
08/02/2022, 5:05 PMschema write
to return?williamdclt
08/02/2022, 5:05 PMzed schema write
took 3 minutes to returnjzelinskie
08/02/2022, 5:07 PMjzelinskie
08/02/2022, 5:16 PM--datastore-revision-quantization-interval
to be something other than the default?Joey
08/02/2022, 5:21 PMwilliamdclt
08/02/2022, 5:21 PMwilliamdclt
08/02/2022, 5:22 PMJoey
08/02/2022, 5:23 PMJoey
08/02/2022, 5:23 PMJoey
08/02/2022, 5:24 PMJoey
08/02/2022, 5:24 PMjzelinskie
08/02/2022, 5:27 PMjzelinskie
08/02/2022, 5:31 PMjzelinskie
08/02/2022, 5:46 PMJoey
08/02/2022, 5:47 PMJoey
08/02/2022, 5:47 PMjzelinskie
08/02/2022, 5:54 PMwilliamdclt
08/02/2022, 5:54 PMjzelinskie
08/02/2022, 5:55 PMjzelinskie
08/02/2022, 5:56 PMJoey
08/02/2022, 6:19 PMJoey
08/02/2022, 6:19 PMJoey
08/02/2022, 6:25 PMwilliamdclt
08/02/2022, 6:53 PMsql
Limit (cost=0.69..4677.70 rows=1 width=129) (actual time=56.761..56.762 rows=0 loops=1)
-> Index Scan using uq_relation_tuple_living on relation_tuple (cost=0.69..135634.24 rows=29 width=129) (actual time=56.760..56.760 rows=0 loops=1)
Index Cond: (((namespace)::text = 'agency'::text) AND ((relation)::text = 'caregiver_or_manager'::text))
Filter: ((created_transaction <= 12666087) AND ((deleted_transaction = '9223372036854775807'::bigint) OR (deleted_transaction > 12666087)))
Planning Time: 0.410 ms
Execution Time: 56.790 ms
This is with fairly random params though:
sql
EXPLAIN ANALYZE SELECT
NAMESPACE,
object_id,
relation,
userset_namespace,
userset_object_id,
userset_relation
FROM
relation_tuple
WHERE
created_transaction <= 52666087
AND (
deleted_transaction = 9223372036854775807
OR deleted_transaction > 52666087
)
AND NAMESPACE = 'agency'
AND relation = 'caregiver_or_manager'
LIMIT 1;
williamdclt
08/02/2022, 6:54 PMJoey
08/02/2022, 6:55 PMJoey
08/02/2022, 6:55 PMJoey
08/02/2022, 6:55 PMJoey
08/02/2022, 6:58 PMjzelinskie
08/02/2022, 8:40 PMjzelinskie
08/02/2022, 8:41 PMjzelinskie
08/02/2022, 8:41 PMJoey
08/02/2022, 8:41 PM