When faced with slow analytical queries in PostgreSQL, a team migrated analytics workloads to BigQuery using Airbyte for the initial migration.
Although the migration to BigQuery initially showed impressive query performance improvements, the inability to define clustering or partitioning with Airbyte resulted in unoptimized data and increased costs.
To address the issue, the team rebuilt the data ingestion pipeline to stream data directly into BigQuery and recreated tables with proper partitioning and clustering.
Despite following best practices and implementing partitioning and clustering in BigQuery, the author discovered that partitioning didn't reduce the amount of data processed as expected.
The author experimented with various ways to query time partitioned tables and discovered that certain functions like CAST() led to processing the entire table rather than pruning partitions.
For TIMESTAMP data type, partition pruning worked effectively for all methods tested, including CAST().
The author highlighted the importance of continuously monitoring and analyzing costly queries in BigQuery to identify inefficiencies that may not be explicitly warned about in documentation.