You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m working with postgres on a table that uses partitioning to manage multi-tenancy for our clients. Each client’s data is stored in a partitioned table, allowing our Hasura Graphql API to expose data for all clients through a single parent table.
Here's a snippet of the dbt model:
{{ config(
materialized='incremental',
pre_hook="TRUNCATE TABLE dagster.computed_achievements_{{ var('client_season') }};",
alias='computed_achievements',
tags=['1.0.0']
) }}
WITH selected_client_season AS (
-- Query logic here
)
Our goal is to refresh a specific partition (based on client_season) without locking the parent table, so other clients’ data remains accessible during the operation. Currently, using TRUNCATE TABLE on a partition seems to lock the parent table, which can disrupt access for other clients.
So my question is:
Is there a way to truncate or refresh a partitioned table in postgres without locking the parent table? We want to perform this operation efficiently without impacting other partitions or client access.
It feels like the method above is an anti-pattern so we're open to suggestions!
The text was updated successfully, but these errors were encountered:
I’m working with postgres on a table that uses partitioning to manage multi-tenancy for our clients. Each client’s data is stored in a partitioned table, allowing our Hasura Graphql API to expose data for all clients through a single parent table.
Here's a snippet of the dbt model:
Our goal is to refresh a specific partition (based on client_season) without locking the parent table, so other clients’ data remains accessible during the operation. Currently, using TRUNCATE TABLE on a partition seems to lock the parent table, which can disrupt access for other clients.
So my question is:
Is there a way to truncate or refresh a partitioned table in postgres without locking the parent table? We want to perform this operation efficiently without impacting other partitions or client access.
It feels like the method above is an anti-pattern so we're open to suggestions!
The text was updated successfully, but these errors were encountered: