Skip to main content
Partitioning your BigQuery tables reduces the amount of data scanned during Artie’s merge operations, which lowers merge latency and can significantly reduce your BigQuery bill. How you enable it depends on whether the table already exists in BigQuery:
  • New tables - Artie creates the table partitioned by day when you choose a partition column in table settings.
  • Existing tables - BigQuery cannot partition a table after it has been created, so you recreate the table and then update table settings.
The examples in this guide use this source table in Postgres:

Choose a partition column

Pick a TIMESTAMP or DATE column that your queries frequently filter on. Good candidates are columns like created_at, updated_at, or event_date. For most CDC workloads, daily time partitioning on a created_at-style column provides the best balance between partition pruning and manageability.

New tables

If Artie has not created the table in BigQuery yet, set the partition column before the table’s first sync and Artie creates it partitioned by day.
1

Set the partition column in table settings

In the Artie dashboard, go to your pipeline > Edit > Tables > find the events table > Table settings.Turn on Use a merge predicate and select the partition column (e.g. created_at).See Table settings for more details on table-level configuration.
2

Deploy

Click Save and then Deploy. When Artie creates the table, it adds the partitioning clause for you:
Artie also includes the partition column in merge predicates, which enables BigQuery to prune partitions during merges.
3

Verify

Follow Verify partitioning once the table has data.
Things to know:
  • The partition column must be a date or timestamp column. If it is not, or if the column is hashed or encrypted, Artie stops with an error instead of creating an unpartitioned table.
  • Artie only creates daily time partitions. To use integer range partitioning, create the partitioned table in BigQuery yourself before the first sync.
  • BigQuery limits a table to 10,000 partitions and a single job to modifying 4,000 partitions. If your partition column spans more than about 10 years of distinct days, partition the table by month in BigQuery yourself before the first sync.

Existing tables

If the table already exists in BigQuery and is not partitioned, recreate it as a partitioned table while your pipeline is paused. You need permissions to run DDL statements (CREATE TABLE, DROP TABLE, ALTER TABLE) in your BigQuery dataset.
1

Pause your Artie pipeline

In the Artie dashboard, navigate to your pipeline and click Pause. This prevents new data from being merged while you restructure the table.
2

Recreate the table with partitioning in BigQuery

Run the following SQL in the BigQuery console to create a partitioned copy, drop the original, and rename the copy:
This operation drops the original table. Verify that the partitioned copy contains all expected data before running the DROP TABLE statement.
After verifying the data in events_copy looks correct:
3

Update table settings in Artie

In the Artie dashboard, go to your pipeline > Edit > Tables > find the events table > Table settings.Turn on Use a merge predicate and select the partition column (e.g. created_at). This tells Artie to include the partition column in merge predicates, which enables BigQuery to prune partitions during merges.See Table settings for more details on table-level configuration.
4

Deploy and verify

Click Save and then Deploy to resume your pipeline, then follow Verify partitioning.

Verify partitioning

To confirm partitioning is active, run the following query in BigQuery:
You should see multiple rows, one per partition, instead of a single NULL partition.

Background

A partitioned table is divided into segments called partitions, making it easier to manage and query your data. By dividing a large table into smaller partitions, you can improve query performance and control costs by reducing the number of bytes read by a query. You partition tables by specifying a partition column which is used to segment the table.
  • Faster merges - Artie’s merge operations scan only the relevant partitions instead of the entire table.
  • Lower costs - Fewer bytes scanned means lower BigQuery compute charges, especially under on-demand pricing.
  • Higher quotas - Partitioned tables have higher DML quotas than unpartitioned tables.
  • Partition-level management - You can write to, delete, or expire individual partitions without affecting the rest of the table.