Tim Möhlmann
b9c1cdf4ad
feat(projections): resource counters ( #9979 )
...
# Which Problems Are Solved
Add the ability to keep track of the current counts of projection
resources. We want to prevent calling `SELECT COUNT(*)` on tables, as
that forces a full scan and sudden spikes of DB resource uses.
# How the Problems Are Solved
- A resource_counts table is added
- Triggers that increment and decrement the counted values on inserts
and deletes
- Triggers that delete all counts of a table when the source table is
TRUNCATEd. This is not in the business logic, but prevents wrong counts
in case someone want to force a re-projection.
- Triggers that delete all counts if the parent resource is deleted
- Script to pre-populate the resource_counts table when a new source
table is added.
The triggers are reusable for any type of resource, in case we choose to
add more in the future.
Counts are aggregated by a given parent. Currently only `instance` and
`organization` are defined as possible parent. This can later be
extended to other types, such as `project`, should the need arise.
I deliberately chose to use `parent_id` to distinguish from the
de-factor `resource_owner` which is usually an organization ID. For
example:
- For users the parent is an organization and the `parent_id` matches
`resource_owner`.
- For organizations the parent is an instance, but the `resource_owner`
is the `org_id`. In this case the `parent_id` is the `instance_id`.
- Applications would have a similar problem, where the parent is a
project, but the `resource_owner` is the `org_id`
# Additional Context
Closes https://github.com/zitadel/zitadel/issues/9957
2025-06-03 14:15:30 +00:00
..
2025-05-28 21:54:18 +00:00
2025-02-13 16:03:05 +00:00
2025-05-28 21:54:18 +00:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-02-11 18:45:09 +00:00
2025-02-11 18:45:09 +00:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-05-19 10:16:49 +00:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-03-31 12:45:11 +02:00
2025-04-02 16:53:06 +02:00
2024-12-06 11:32:53 +00:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2024-02-28 10:55:54 +02:00
2025-05-28 21:54:18 +00:00
2025-05-28 21:54:18 +00:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2024-09-11 08:24:00 +00:00
2024-09-11 08:24:00 +00:00
2024-09-11 08:24:00 +00:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2024-04-16 11:19:17 +00:00
2025-04-30 12:58:10 +00:00
2025-04-30 12:58:10 +00:00
2025-04-30 12:58:10 +00:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-05-23 13:52:25 +02:00
2025-05-23 13:52:25 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-22 08:42:59 +00:00
2025-04-02 16:53:06 +02:00
2024-12-04 18:10:10 +00:00
2024-09-25 21:40:21 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-28 11:24:50 +02:00
2025-04-28 11:24:50 +02:00
2025-04-28 11:24:50 +02:00
2025-05-21 10:50:44 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-05-21 10:50:44 +02:00
2024-10-04 13:15:41 +00:00
2024-09-17 11:34:14 +00:00
2025-04-02 16:53:06 +02:00
2024-09-17 11:34:14 +00:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2023-11-20 17:21:08 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2022-06-14 07:51:00 +02:00
2025-01-15 09:40:30 +01:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2024-12-19 10:37:46 +01:00
2025-04-02 16:53:06 +02:00
2024-12-19 10:37:46 +01:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-06-02 16:27:53 +00:00
2025-06-03 14:48:15 +02:00
2025-06-03 14:48:15 +02:00
2024-11-21 08:05:03 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-22 08:42:59 +00:00
2025-04-22 08:42:59 +00:00
2025-04-22 08:42:59 +00:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-05-21 14:40:47 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-05-21 14:40:47 +02:00
2025-04-02 16:53:06 +02:00
2025-05-21 14:40:47 +02:00
2024-01-25 17:28:20 +01:00
2025-04-22 08:42:59 +00:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-06-03 14:15:30 +00:00
2025-06-03 14:15:30 +00:00
2025-06-03 14:15:30 +00:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-05-19 10:16:49 +00:00
2025-04-02 16:53:06 +02:00
2025-02-13 16:03:05 +00:00
2025-04-02 16:53:06 +02:00
2025-02-13 16:03:05 +00:00
2025-01-29 15:22:22 +02:00
2025-01-29 15:22:22 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-22 08:42:59 +00:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-28 11:24:50 +02:00
2025-04-28 11:24:50 +02:00
2025-04-28 11:24:50 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2024-11-28 10:06:52 +00:00
2024-11-28 10:06:52 +00:00
2025-04-02 16:53:06 +02:00
2025-03-28 12:36:05 +00:00
2025-04-22 08:42:59 +00:00
2025-01-30 16:43:13 +01:00
2025-05-08 07:32:41 +00:00
2025-04-02 16:53:06 +02:00
2025-05-28 21:54:18 +00:00
2025-04-02 16:53:06 +02:00
2025-05-28 21:54:18 +00:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-01-29 15:12:31 +00:00
2025-05-08 07:32:41 +00:00
2023-12-08 15:30:55 +01:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2024-08-28 19:46:45 +00:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-05-26 13:23:38 +02:00
2025-01-29 15:12:31 +00:00
2024-04-09 15:15:35 +02:00
2025-04-02 16:53:06 +02:00
2024-06-14 10:00:43 +02:00
2024-08-16 11:41:09 +00:00
2024-08-16 11:41:09 +00:00
2024-08-14 14:18:14 +00:00
2024-08-16 11:41:09 +00:00
2025-04-02 16:53:06 +02:00
2024-08-14 14:18:14 +00:00
2023-11-20 17:21:08 +02:00