{"id":553412,"date":"2025-02-17T12:00:19","date_gmt":"2025-02-17T11:00:19","guid":{"rendered":"https:\/\/www.devoteam.com\/expert-view\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\/"},"modified":"2025-09-15T15:46:37","modified_gmt":"2025-09-15T13:46:37","slug":"optimise-your-data-warehouse-bigquery-nested-and-repeated-fields","status":"publish","type":"expert-view","link":"https:\/\/devoteam.info\/en-se\/expert-view\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\/","title":{"rendered":"Optimise Your Data Warehouse: BigQuery Nested and Repeated Fields"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"h-introduction\"><strong>Introduction<\/strong><\/h2>\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/devoteam.info\/expert-view\/improve-bigquery-performance-normalisation-vs-denormalisation\/\">In my previous blog post<\/a>, we explored the pros and cons of normalised and denormalised data structures in data warehouses. While normalised data offers advantages such as reduced redundancy and improved data integrity, denormalised structures can lead to faster and more cost-efficient query performance. This is especially true for complex queries due to the reduction in joins. Although denormalisation can increase data redundancy, the performance gains often outweigh the drawbacks, particularly when query speed is essential.<\/p>\n\n<p class=\"wp-block-paragraph\">This article explores the advantages of using nested and repeated fields in <a href=\"https:\/\/cloud.google.com\/bigquery?utm_source=google&amp;utm_medium=cpc&amp;utm_campaign=emea-se-all-en-dr-bkws-all-all-trial-e-gcp-1707574&amp;utm_content=text-ad-none-any-dev_c-cre_677712329218-adgp_Hybrid+%7C+BKWS+-+MIX+%7C+Txt+-+Data+Analytics+-+BigQuery-kwid_43700078347491920-kwd-47616965283-userloc_9062455&amp;utm_term=kw_bigquery-net_g-plac_&amp;&amp;gad_source=1&amp;gclid=CjwKCAiA2cu9BhBhEiwAft6IxIGnVL1pvaNvUMnni4OSKMhrl3fjWH1eO7xClaRdmjnpQP0M9dTHVhoCjQMQAvD_BwE&amp;gclsrc=aw.ds&amp;hl=en\">BigQuery<\/a> for storing hierarchical data. These data structures can provide significant performance improvements compared to traditional, flattened models. By leveraging nested and repeated fields, you can maintain the benefits of denormalisation while mitigating its drawbacks.<\/p>\n\n<h2 class=\"wp-block-heading\" id=\"h-flattened-nested-and-repeated-data-in-bigquery\">Flattened, Nested and Repeated data in BigQuery<\/h2>\n\n<p class=\"wp-block-paragraph\"><strong>Flattened data<\/strong> refers to a default table structure where data is stored in a non-hierarchical format, with each row representing a single record and its associated attributes. This contrasts with nested and repeated fields, which are great tools for storing data in its original organisation while harnessing the benefits of <a href=\"https:\/\/devoteam.info\/expert-view\/improve-bigquery-performance-normalisation-vs-denormalisation\/\">denormalised data<\/a>.<\/p>\n\n<p class=\"wp-block-paragraph\"><strong>Repeated fields<\/strong> can contain multiple values for a single record. They\u2019re ideal for storing hierarchical data in a single table while minimising storage cost.<\/p>\n\n<p class=\"wp-block-paragraph\"><strong>Nested fields<\/strong> are STRUCTs (structure data type fields in SQL), which are standard SQL data types that can be seen as pre-joined tables within a table. It\u2019s possible to have a repeated STRUCT inside of a table, simulating a 1-many connection to another table but built inside the current one to avoid costly joins by utilising arrays.<\/p>\n\n<p class=\"wp-block-paragraph\">In this blog post I explore only this 1-many relationship, therefore all further mentions of BigQuery nested fields refer to repeated STRUCTs.<\/p>\n\n<p class=\"wp-block-paragraph\">Both BigQuery nested and repeated fields can be used to preserve the relational qualities of the original data and schema while enabling columnar and parallel processing of the repeated fields.<\/p>\n\n<p class=\"wp-block-paragraph\">Through these fields, one can have ONE ROW for each entity and repeated values within that ONE ROW for data at a more granular level.<\/p>\n\n<h2 class=\"wp-block-heading\" id=\"h-query-performance-testing-flattened-vs-repeated-nested-tables\">Query Performance Testing: Flattened vs. Repeated\/Nested tables<\/h2>\n\n<p class=\"wp-block-paragraph\">To get an understanding of the pros and cons of using flattened vs. repeated or nested tables, the columns\u00a0Commit, Subject and Repo_name from the public dataset table github_repos.commits in BigQuery have been stored in the respective formats.\u00a0<\/p>\n\n<p class=\"wp-block-paragraph\">The dataset focuses on the individual commits and a large number of metadata around each. This metadata includes the subject of each commit. You will also find information about the repos in which it can be found. Due to Forks or Cherry-picking of commits, they can be found in a large number of different repositories. The public dataset stores the repos a commit appears in inside an array. For this experiment, they were also stored inside a nested form (an array inside a STRUCT) and a flattened form (commit and subject fields duplicated for each repo belonging to a commit).<\/p>\n\n<p class=\"wp-block-paragraph\">Aside from their different formats, the tables also have vastly different sizes. The flattened tables have a size of 427.88 GB, while the nested and repeated tables have \u201conly\u201d a size of 112.28 GB. These demonstrated a much more efficient use of storage while storing all the same data in a single table.<\/p>\n\n<p class=\"wp-block-paragraph\">This difference in size has a large impact on storage and query cost. The storage cost for the flattened table is $7.77\/ mo, while the storage for each of the optimised tables is $1.89\/ mo in the US multi-region used for these experiments.<\/p>\n\n<p class=\"wp-block-paragraph\">The queries that were used to create the three different tables for the subsequent performance tests can be found in the appendix.<\/p>\n\n<p class=\"wp-block-paragraph\">The Tables have the following formats:<\/p>\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"291\" src=\"https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-17-at-09.49.32-1024x291.png\" alt=\"Table with flattened data\" class=\"wp-image-528283\" srcset=\"https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-17-at-09.49.32-1024x291.png 1024w, https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-17-at-09.49.32-300x85.png 300w, https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-17-at-09.49.32-768x219.png 768w, https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-17-at-09.49.32.png 1518w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"265\" src=\"https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-17-at-09.51.16-1024x265.png\" alt=\"Table with Nested data\" class=\"wp-image-528346\" srcset=\"https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-17-at-09.51.16-1024x265.png 1024w, https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-17-at-09.51.16-300x78.png 300w, https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-17-at-09.51.16-768x199.png 768w, https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-17-at-09.51.16.png 1516w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"258\" src=\"https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-17-at-09.51.55-1024x258.png\" alt=\"Table with repeated data\" class=\"wp-image-528367\" srcset=\"https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-17-at-09.51.55-1024x258.png 1024w, https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-17-at-09.51.55-300x76.png 300w, https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-17-at-09.51.55-768x194.png 768w, https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-17-at-09.51.55.png 1522w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n<h3 class=\"wp-block-heading\">Test Scenarios<\/h3>\n\n<p class=\"wp-block-paragraph\">To compare the different storage formats, they were tested in three different scenarios and compared based on their query speed and query cost. The specific queries used in the analysis can be found in the <a href=\"#h-appendix\">appendix<\/a>.<\/p>\n\n<p class=\"wp-block-paragraph\">The three scenarios tested were:<\/p>\n\n<h4 class=\"wp-block-heading\" id=\"h-1st-scenario-simple-filtering\">1st Scenario: Simple Filtering<\/h4>\n\n<ul class=\"wp-block-list\">\n<li>This scenario tests how quickly you can filter data based on a condition in the repo_name field.<\/li>\n<\/ul>\n\n<h4 class=\"wp-block-heading\" id=\"h-2nd-scenario-counting-repositories\">2nd Scenario: Counting Repositories<\/h4>\n\n<ul class=\"wp-block-list\">\n<li>This scenario tests how efficiently you can count the number of repositories associated with each commit and subject.<\/li>\n<\/ul>\n\n<h4 class=\"wp-block-heading\" id=\"h-3rd-scenario-filtering-on-multiple-repositories\">3rd Scenario: Filtering on Multiple Repositories<\/h4>\n\n<ul class=\"wp-block-list\">\n<li>This scenario tests filtering based on the presence of multiple specific repositories.<\/li>\n<\/ul>\n\n<h3 class=\"wp-block-heading\">Test Results<\/h3>\n\n<h4 class=\"wp-block-heading\" id=\"h-query-speed\">Query Speed<\/h4>\n\n<p class=\"wp-block-paragraph\">As visible in the charts below, in all cases, the flattened format loses out against the nested and repeated formats. This is to be expected since so many more fields need to be processed during each query. The duration for all queries is impressively low due to BigQuerries parallel computation, but when looking at the Slot time consumed, it\u2019s possible to see how much more effort querying the flattened data is and how powerful BigQuery is at hiding this computation from the user by delivering the results in record speed.<\/p>\n\n<p class=\"wp-block-paragraph\">Currently the user doesn\u2019t need to think about slot time consumed because it doesn\u2019t affect the pricing of BigQuery. For now the billing only depends on bytes processed but this is subject to change and there are plans to include slot time consumed into the formula, which will make these differences highly relevant to all users.<\/p>\n\n<p class=\"wp-block-paragraph\">The performance of repeated and nested fields appears to be the same, with minor variations between runs. This result is encouraging, as it suggests that there is no performance penalty for storing data in BigQuery nested fields to maintain its original structure.<\/p>\n\n<figure class=\"wp-block-image aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"934\" height=\"576\" src=\"https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/AD_4nXexEPMVMKWYCwqd8btw37w2xQh6jN1iUGmv-PBL_wlZ3yPNsh3RsIWun65blZ6xV3LZr7SnZtt-6o_SSVHrV0hEdsnzMhpMPTUfs94cWzq8P9GBpitLlfvGhk6bQSMU3brYtIhRo8ABzd5PgbeOSW3QFSvW.png\" alt=\"Query speed test result measured by duration in seconds\" class=\"wp-image-528534\" style=\"width:600px\" title=\"Chart\" srcset=\"https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/AD_4nXexEPMVMKWYCwqd8btw37w2xQh6jN1iUGmv-PBL_wlZ3yPNsh3RsIWun65blZ6xV3LZr7SnZtt-6o_SSVHrV0hEdsnzMhpMPTUfs94cWzq8P9GBpitLlfvGhk6bQSMU3brYtIhRo8ABzd5PgbeOSW3QFSvW.png 934w, https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/AD_4nXexEPMVMKWYCwqd8btw37w2xQh6jN1iUGmv-PBL_wlZ3yPNsh3RsIWun65blZ6xV3LZr7SnZtt-6o_SSVHrV0hEdsnzMhpMPTUfs94cWzq8P9GBpitLlfvGhk6bQSMU3brYtIhRo8ABzd5PgbeOSW3QFSvW-300x185.png 300w, https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/AD_4nXexEPMVMKWYCwqd8btw37w2xQh6jN1iUGmv-PBL_wlZ3yPNsh3RsIWun65blZ6xV3LZr7SnZtt-6o_SSVHrV0hEdsnzMhpMPTUfs94cWzq8P9GBpitLlfvGhk6bQSMU3brYtIhRo8ABzd5PgbeOSW3QFSvW-768x474.png 768w\" sizes=\"auto, (max-width: 934px) 100vw, 934px\" \/><\/figure>\n\n<figure class=\"wp-block-image aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"934\" height=\"576\" src=\"https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/AD_4nXcBJTLwvZgvT_BrFXJKU2iD9q-ZX6-PsMoMYlcR7_P8tIvmH6u4M3vXuvcuNK7L3M5QMSoGp1fq-KZYBMKvyePuuxPmV-IVfMK2o6edR93PbIoifCYnbiMQ0PBJGXiryez1EGciMr8M6-NlqaM1LF2qREhV.png\" alt=\"Query speed test result measured by slot time consumed in hours: bigquery nested and repeated fields vs flattened fields\" class=\"wp-image-528533\" style=\"width:600px\" title=\"Chart\" srcset=\"https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/AD_4nXcBJTLwvZgvT_BrFXJKU2iD9q-ZX6-PsMoMYlcR7_P8tIvmH6u4M3vXuvcuNK7L3M5QMSoGp1fq-KZYBMKvyePuuxPmV-IVfMK2o6edR93PbIoifCYnbiMQ0PBJGXiryez1EGciMr8M6-NlqaM1LF2qREhV.png 934w, https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/AD_4nXcBJTLwvZgvT_BrFXJKU2iD9q-ZX6-PsMoMYlcR7_P8tIvmH6u4M3vXuvcuNK7L3M5QMSoGp1fq-KZYBMKvyePuuxPmV-IVfMK2o6edR93PbIoifCYnbiMQ0PBJGXiryez1EGciMr8M6-NlqaM1LF2qREhV-300x185.png 300w, https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/AD_4nXcBJTLwvZgvT_BrFXJKU2iD9q-ZX6-PsMoMYlcR7_P8tIvmH6u4M3vXuvcuNK7L3M5QMSoGp1fq-KZYBMKvyePuuxPmV-IVfMK2o6edR93PbIoifCYnbiMQ0PBJGXiryez1EGciMr8M6-NlqaM1LF2qREhV-768x474.png 768w\" sizes=\"auto, (max-width: 934px) 100vw, 934px\" \/><\/figure>\n\n<h4 class=\"wp-block-heading\" id=\"h-query-cost\">Query Cost<\/h4>\n\n<p class=\"wp-block-paragraph\">As visible in the chart below, the bytes processed are consistent across all three scenarios since all scenarios need to read the entire tables. Due to the aforementioned large size differences between the tables, the query costs are squally skewed with the queries of the flattened table being much more expensive than the queries of the repeated and nested tables.\u00a0<\/p>\n\n<p class=\"wp-block-paragraph\">Each query of the flattened table (427.88 GB) currently costs $2.67,\u00a0 while querying the other tables (112.28 GB) costs $0.7.<\/p>\n\n<figure class=\"wp-block-image aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"934\" height=\"576\" src=\"https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/AD_4nXfOvvbvsxPjPzvzTKh_sJRst4iKhBUM-BtOGEzc39iWITVeu4pfSCzsu0Mb0s-2hm-xNLIieHvIj4j_wWouQD9v2gXV2bCONDO49lj7BIKv5HiyhBiMXIlGoDYcIvkdWcO3QOp9oQ.png\" alt=\"Query cost test result measured by gigabytes processed: bigquery nested and repeated fields vs flattened fields\" class=\"wp-image-528512\" style=\"width:600px\" title=\"Chart\" srcset=\"https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/AD_4nXfOvvbvsxPjPzvzTKh_sJRst4iKhBUM-BtOGEzc39iWITVeu4pfSCzsu0Mb0s-2hm-xNLIieHvIj4j_wWouQD9v2gXV2bCONDO49lj7BIKv5HiyhBiMXIlGoDYcIvkdWcO3QOp9oQ.png 934w, https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/AD_4nXfOvvbvsxPjPzvzTKh_sJRst4iKhBUM-BtOGEzc39iWITVeu4pfSCzsu0Mb0s-2hm-xNLIieHvIj4j_wWouQD9v2gXV2bCONDO49lj7BIKv5HiyhBiMXIlGoDYcIvkdWcO3QOp9oQ-300x185.png 300w, https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/AD_4nXfOvvbvsxPjPzvzTKh_sJRst4iKhBUM-BtOGEzc39iWITVeu4pfSCzsu0Mb0s-2hm-xNLIieHvIj4j_wWouQD9v2gXV2bCONDO49lj7BIKv5HiyhBiMXIlGoDYcIvkdWcO3QOp9oQ-768x474.png 768w\" sizes=\"auto, (max-width: 934px) 100vw, 934px\" \/><\/figure>\n\n<h2 class=\"wp-block-heading\">Verdict<\/h2>\n\n<p class=\"wp-block-paragraph\">BigQuery nested\/repeated fields offer significant advantages. In our experience, they reduced storage costs by a remarkable 74% and also decreased query costs.<\/p>\n\n<p class=\"wp-block-paragraph\">Initially, we anticipated potential tradeoffs in query speed when using these fields. However, we were pleasantly surprised to discover the opposite was true. The performance improvements were impressive.<\/p>\n\n<p class=\"wp-block-paragraph\">Furthermore, storing data in a repeated format enhances readability. It becomes much easier to visually inspect and interpret the information.<\/p>\n\n<p class=\"wp-block-paragraph\">Even queries that explore the hierarchical relationship between commits and repositories is simpler to construct and comprehend when the data is stored in this format.<\/p>\n\n<p class=\"wp-block-paragraph\">These findings highlight how denormalised tables, enriched with repeated and nested fields, can combine the strengths of both normalised and denormalised data models, without their respective drawbacks.<\/p>\n\n<figure class=\"wp-block-table is-style-stripes\"><table class=\"has-secondary-background-color has-background has-fixed-layout\"><tbody><tr><td><strong>Feature<\/strong><\/td><td><strong>Flattened Data<\/strong><\/td><td><strong>Nested\/Repeated Data\u00a0<\/strong><\/td><\/tr><tr><td><strong>Table Size<\/strong><\/td><td>Larger table size due to data redundancy<\/td><td>Smaller table size due to efficient data storage<\/td><\/tr><tr><td><strong>Storage Cost<\/strong><\/td><td>Higher storage cost due to larger table size<\/td><td>Lower storage cost due to smaller table size<\/td><\/tr><tr><td><strong>Query Performance<\/strong><\/td><td>Lower query performance, more fields need to be processed<\/td><td>Higher query performance, fewer fields need to be processed<\/td><\/tr><tr><td><strong>Query Cost<\/strong><\/td><td>Higher query cost due to larger data size<\/td><td>Lower query cost due to smaller data size<\/td><\/tr><tr><td><strong>Readability<\/strong><\/td><td>More difficult to read as data relationships are not immediately clear<\/td><td>Easier to read and interpret because data is stored closer to its original structure<\/td><\/tr><tr><td><strong>Data Relationships<\/strong><\/td><td>Data relationships can be lost due to duplication of fields across multiple rows<\/td><td>Preserves relational qualities of the original data and schema<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-main-color\">Results of the experiment: flattened data vs. nested\/repeated data<\/mark><\/figcaption><\/figure>\n\n<h4 class=\"wp-block-heading\" id=\"h-additional-resources\">Additional resources<br\/><\/h4>\n\n<p class=\"wp-block-paragraph\">Want more BigQuery resources? Check our other blog posts:<\/p>\n\n<ol class=\"wp-block-list\">\n<li>Part one of the optimisation series: <a href=\"https:\/\/devoteam.info\/expert-view\/improve-bigquery-performance-normalisation-vs-denormalisation\/\">Improve BigQuery Performance: Normalisation vs Denormalisation<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/devoteam.info\/expert-view\/how-to-set-up-a-cloud-run-job-to-read-and-write-on-bigquery\/\">How to set up a Cloud Run job to read and write on BigQuery<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/devoteam.info\/en-se\/expert-view\/3-options-to-protect-bigquery-data-with-row-level-security\/\">3 ways to protect your BigQuery data with row-level security<\/a><\/li>\n\n\n\n<li>Success Story: <a href=\"https:\/\/devoteam.info\/en-se\/success-story\/how-bambuser-optimized-their-bigquery-costs\/\">How Bambuser optimised their BigQuery costs<\/a><\/li>\n<\/ol>\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n<div class=\"wp-block-cover alignfull is-style-blur-image is-style-blur-image-less\" style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-right:0;padding-bottom:0;padding-left:0\"><span aria-hidden=\"true\" class=\"wp-block-cover__background has-black-background-color has-background-dim-70 has-background-dim\"><\/span><img loading=\"lazy\" decoding=\"async\" width=\"2000\" height=\"1334\" src=\"https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133.jpg\" class=\"wp-block-cover__image-background wp-post-image\" alt=\"\" data-object-fit=\"cover\" srcset=\"https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133.jpg 2000w, https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133-300x200.jpg 300w, https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133-1024x683.jpg 1024w, https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133-768x512.jpg 768w, https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133-1536x1025.jpg 1536w\" sizes=\"auto, (max-width: 2000px) 100vw, 2000px\" \/><div class=\"wp-block-cover__inner-container is-layout-flow wp-block-cover-is-layout-flow\">\n<div class=\"wp-block-group alignfull has-base-color has-text-color has-global-padding is-layout-constrained wp-container-core-group-is-layout-46b67d08 wp-block-group-is-layout-constrained\" style=\"margin-top:0px;margin-bottom:0px;padding-top:var(--wp--preset--spacing--xxx-large);padding-right:var(--wp--preset--spacing--medium);padding-bottom:var(--wp--preset--spacing--xxx-large);padding-left:var(--wp--preset--spacing--medium)\">\n<div class=\"wp-block-group is-layout-flow wp-block-group-is-layout-flow\">\n<div class=\"wp-block-group has-global-padding is-content-justification-left is-layout-constrained wp-container-core-group-is-layout-5f9de3d0 wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading has-text-align-left has-secondary-font-family has-large-font-size\" id=\"h-want-to-optimise-your-bigquery-data-warehouse-and-slash-costs\">Want to optimise your BigQuery data warehouse and slash costs?<\/h2>\n<\/div>\n\n\n\n<p class=\"has-text-align-left has-main-accent-color has-text-color wp-block-paragraph\">Contact our experts and unlock the full potential of your data! In the mood for learning? Explore our data resources!<\/p>\n\n\n\n<div class=\"wp-block-buttons is-content-justification-left is-layout-flex wp-container-core-buttons-is-layout-3c38c079 wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/devoteam.info\/en-se\/google-cloud\/data-solutions\/\">Start your Data journey<\/a><\/div>\n\n\n\n<div class=\"wp-block-button is-style-outline-white-button\"><a class=\"wp-block-button__link has-base-color has-text-color has-background wp-element-button\" href=\"https:\/\/devoteam.info\/en-se\/insights\/?category_name=data\" style=\"background-color:#64648254\">Get more resources<\/a><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div><\/div>\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<div class=\"wp-block-group has-border-color has-secondary-border-color has-base-background-color has-background has-global-padding is-layout-constrained wp-container-core-group-is-layout-df60c9d2 wp-block-group-is-layout-constrained\" style=\"border-width:19px;margin-top:var(--wp--preset--spacing--medium);margin-bottom:var(--wp--preset--spacing--medium);padding-top:var(--wp--preset--spacing--small);padding-right:var(--wp--preset--spacing--small);padding-bottom:var(--wp--preset--spacing--small);padding-left:var(--wp--preset--spacing--small)\">\n<h2 class=\"wp-block-heading\" id=\"h-appendix\">Appendix<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-1-create-tables\">1. Create Tables<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-table-with-repeated-data\"><strong>Table with repeated data<\/strong>:<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">CREATE TABLE<\/mark> query_speed_blog.git_commits_repeated <mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">AS<\/mark> (<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">\u00a0SELECT<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">\u00a0\u00a0\u00a0commit,<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0subject,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0repo_name<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">\u00a0FROM<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0`<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1c9e26\" class=\"has-inline-color\">bigquery-public-data.github_repos.commits<\/mark>`<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">);<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-table-with-nested-struct-data\"><strong>Table with nested (STRUCT) data:<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">CREATE TABLE<\/mark> query_speed_blog.git_commits_nested <mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">AS<\/mark> (<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">\u00a0SELECT<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">commit<\/mark>,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0subject,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">STRUCT<\/mark>(repo_name <mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">AS<\/mark> name) <mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">AS<\/mark> repo<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">\u00a0FROM<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0`<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1c9e26\" class=\"has-inline-color\">bigquery-public-data.github_repos.commits<\/mark>`<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">);<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-table-with-flattened-data\"><strong>Table with flattened data:<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">CREATE TABLE<\/mark> query_speed_blog.git_commits_flattened <mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">AS<\/mark> (<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">\u00a0SELECT<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">\u00a0\u00a0\u00a0commit,<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0subject,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0repo_name<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">\u00a0FROM<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0`<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1c9e26\" class=\"has-inline-color\">bigquery-public-data.github_repos.commits<\/mark>`,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">UNNEST<\/mark>(repo_name) <mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">AS<\/mark> repo_name<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">);<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-2-testing-queries\">2. Testing Queries<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-1st-scenario-simple-filtering-0\">1st <strong>Scenario: Simple Filtering<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Flattened Table Query:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">SELECT<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">commit<\/mark>,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0subject,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0repo_name<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">\u00a0FROM<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0`<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1c9e26\" class=\"has-inline-color\">query_speed_blog.git_commits_flattened<\/mark>`<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">WHERE<\/mark> repo_name = \u2018<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1c9e26\" class=\"has-inline-color\">tensorflow\/tensorflow\u2019<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Repeated Table Query:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">SELECT<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">\u00a0\u00a0commit,<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0subject,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0repo_name<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">FROM<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0`<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1c9e26\" class=\"has-inline-color\">query_speed_blog.git_commits_repeated<\/mark>`,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">UNNEST<\/mark>(repo_name) as repo_name<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">WHERE<\/mark> &#8216;<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1c9e26\" class=\"has-inline-color\">tensorflow\/tensorflow<\/mark>&#8216; = repo_name<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Table with nested (STRUCT) data Query:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">SELECT<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">\u00a0\u00a0commit,<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0subject,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0repo_name<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">FROM<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0`<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1c9e26\" class=\"has-inline-color\">query_speed_blog.git_commits_nested<\/mark>`,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0unnest(repo.name) as repo_name<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">WHERE<\/mark> &#8216;<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1c9e26\" class=\"has-inline-color\">tensorflow\/tensorflow<\/mark>&#8216; = repo_name<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-2-nd-scenario-counting-repositories\"><strong>2<\/strong>nd <strong>Scenario: Counting Repositories<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Flattened Table Query:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">SELECT<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">\u00a0\u00a0\u00a0commit,<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0subject,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">COUNT<\/mark>(repo_name) <mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">AS<\/mark> repo_count<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">\u00a0FROM<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0`<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1c9e26\" class=\"has-inline-color\">query_speed_blog.git_commits_flattened<\/mark>`<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">\u00a0GROUP BY <\/mark><mark style=\"background-color:rgba(0, 0, 0, 0);color:#ca1754\" class=\"has-inline-color\">1, 2<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">LIMIT<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#ca1754\" class=\"has-inline-color\">\u00a01000000<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Repeated Table Query:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">SELECT<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">\u00a0commit,<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0subject,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">ARRAY_LENGTH<\/mark>(repo_name) <mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">AS<\/mark> repo_count<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">FROM<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0`<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1c9e26\" class=\"has-inline-color\">query_speed_blog.git_commits_repeated<\/mark>`<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">LIMIT<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#ca1754\" class=\"has-inline-color\">\u00a01000000<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Table with nested (STRUCT) data Query:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">SELECT<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">commit,<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">subject,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">ARRAY_LENGTH<\/mark>(repo.name) <mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">AS<\/mark> repo_count<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">FROM<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">`<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1c9e26\" class=\"has-inline-color\">query_speed_blog.git_commits_nested<\/mark>`<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">LIMIT<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#ca1754\" class=\"has-inline-color\">1000000<\/mark><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-3rd-scenario-filtering-on-multiple-repositories-0\">3rd <strong>Scenario: Filtering on Multiple Repositories<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Flattened Table Query:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">SELECT<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">commit<\/mark>,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0subject,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">\u00a0ARRAY_AGG<\/mark>(repo_name) <mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">AS<\/mark> repos<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">FROM<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0\u00a0`<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1c9e26\" class=\"has-inline-color\">query_speed_blog.git_commits_flattened<\/mark>`<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">\u00a0WHERE<\/mark> repo_name = &#8216;<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1c9e26\" class=\"has-inline-color\">tensorflow\/tensorflow<\/mark>&#8216; <mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">OR<\/mark> repo_name = &#8216;<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1c9e26\" class=\"has-inline-color\">Intel-tensorflow\/tensorflow<\/mark>&#8216;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">GROUP BY<\/mark> <mark style=\"background-color:rgba(0, 0, 0, 0);color:#ca1754\" class=\"has-inline-color\">1, 2<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">HAVING <\/mark>count(*) = <mark style=\"background-color:rgba(0, 0, 0, 0);color:#ca1754\" class=\"has-inline-color\">2<\/mark>;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Repeated Table Query:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">SELECT<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">commit<\/mark>,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0subject,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0repo_name<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">FROM<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0`<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1c9e26\" class=\"has-inline-color\">query_speed_blog.git_commits_repeated<\/mark>`<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">WHERE EXISTS (SELECT 1 FROM UNNEST<\/mark>(repo_name) <mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">AS<\/mark> name <mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">WHERE<\/mark> name = &#8216;<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1c9e26\" class=\"has-inline-color\">tensorflow\/tensorflow<\/mark>&#8216;)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">AND EXISTS (SELECT 1 FROM UNNEST<\/mark>(repo_name) <mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">AS<\/mark> name <mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">WHERE <\/mark>name = &#8216;<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1c9e26\" class=\"has-inline-color\">Intel-tensorflow\/tensorflow&#8217;<\/mark>);<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Table with nested (STRUCT) data Query:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">SELECT<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">\u00a0commit,<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0subject,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0repo.name<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">FROM<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0`<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1c9e26\" class=\"has-inline-color\">query_speed_blog.git_commits_nested<\/mark>`<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">WHERE EXISTS (SELECT 1 FROM UNNEST<\/mark>(repo.name) <mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">AS<\/mark> name <mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">WHERE<\/mark> name = &#8216;<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1c9e26\" class=\"has-inline-color\">tensorflow\/tensorflow<\/mark>&#8216;)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u00a0\u00a0<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">AND EXISTS (SELECT 1 FROM UNNEST<\/mark>(repo.name) <mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">AS<\/mark> name <mark style=\"background-color:rgba(0, 0, 0, 0);color:#1b70e4\" class=\"has-inline-color\">WHERE<\/mark> name = &#8216;<mark style=\"background-color:rgba(0, 0, 0, 0);color:#1c9e26\" class=\"has-inline-color\">Intel-tensorflow\/tensorflow<\/mark>&#8216;);<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-\"><\/h4>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Part 2 of BigQuery Optimisation series! Learn about the advantages of using nested and repeated fields in BigQuery. <\/p>\n","protected":false},"featured_media":360259,"template":"","categories":[2332,922],"tags":[2308,2286],"industry":[],"class_list":["post-553412","expert-view","type-expert-view","status-publish","has-post-thumbnail","hentry","category-data-en-se","category-google-cloud-en-se","tag-data-en-se","tag-google-cloud-en-se"],"acf":[],"cards":"\n\t<div class=\"single-post-card\">\n\n\t\t<figure class=\"wp-block-post-featured-image\"><a href=\"https:\/\/devoteam.info\/en-se\/expert-view\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\/\" target=\"_self\" ><img width=\"2000\" height=\"1334\" src=\"https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133.jpg\" class=\"attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"Optimise Your Data Warehouse: BigQuery Nested and Repeated Fields\" style=\"aspect-ratio:4\/3;width:100%;object-fit:cover;\" decoding=\"async\" loading=\"lazy\" srcset=\"https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133.jpg 2000w, https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133-300x200.jpg 300w, https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133-1024x683.jpg 1024w, https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133-768x512.jpg 768w, https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133-1536x1025.jpg 1536w\" sizes=\"auto, (max-width: 2000px) 100vw, 2000px\" \/><\/a><\/figure>\n\n\t\t\n\t\t<div class=\"wp-block-group is-vertical is-layout-flex wp-container-core-group-is-layout-43282307 wp-block-group-is-layout-flex\">\n\t<p style=\"font-style:normal;font-weight:700\" class=\"has-link-color wp-elements-1 wp-block-lp-post-type has-text-color has-primary-color has-small-font-size\">Expert View<\/p>\n\n\t\t\n\t\t<h3 style=\"font-style:normal;font-weight:400\" class=\"wp-block-post-title has-base-font-size\"><a href=\"https:\/\/devoteam.info\/en-se\/expert-view\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\/\" target=\"_self\" >Optimise Your Data Warehouse: BigQuery Nested and Repeated Fields<\/a><\/h3><\/div>\n\t\t\n\t<\/div>\n\n","yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.4 (Yoast SEO v28.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Optimise Your Data Warehouse: BigQuery Nested Fields<\/title>\n<meta name=\"description\" content=\"Optimise your BigQuery data warehouse with nested fields for faster queries and lower costs. Learn from our expert!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/devoteam.info\/en-se\/expert-view\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Optimise Your Data Warehouse: BigQuery Nested and Repeated Fields\" \/>\n<meta property=\"og:description\" content=\"Optimise your BigQuery data warehouse with nested fields for faster queries and lower costs. Learn from our expert!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/devoteam.info\/en-se\/expert-view\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\/\" \/>\n<meta property=\"og:site_name\" content=\"Devoteam\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-15T13:46:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/Copy-of-Social-media.Nested-Fields.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"627\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/devoteam.info\\\/en-se\\\/expert-view\\\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\\\/\",\"url\":\"https:\\\/\\\/devoteam.info\\\/en-se\\\/expert-view\\\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\\\/\",\"name\":\"Optimise Your Data Warehouse: BigQuery Nested Fields\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/devoteam.info\\\/en-se\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/devoteam.info\\\/en-se\\\/expert-view\\\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/devoteam.info\\\/en-se\\\/expert-view\\\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/devoteam.info\\\/wp-content\\\/uploads\\\/2024\\\/12\\\/Data-Driven-Intelligence-1-e1685612604133.jpg\",\"datePublished\":\"2025-02-17T11:00:19+00:00\",\"dateModified\":\"2025-09-15T13:46:37+00:00\",\"description\":\"Optimise your BigQuery data warehouse with nested fields for faster queries and lower costs. Learn from our expert!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/devoteam.info\\\/en-se\\\/expert-view\\\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\\\/#breadcrumb\"},\"inLanguage\":\"en-SE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/devoteam.info\\\/en-se\\\/expert-view\\\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-SE\",\"@id\":\"https:\\\/\\\/devoteam.info\\\/en-se\\\/expert-view\\\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\\\/#primaryimage\",\"url\":\"https:\\\/\\\/devoteam.info\\\/wp-content\\\/uploads\\\/2024\\\/12\\\/Data-Driven-Intelligence-1-e1685612604133.jpg\",\"contentUrl\":\"https:\\\/\\\/devoteam.info\\\/wp-content\\\/uploads\\\/2024\\\/12\\\/Data-Driven-Intelligence-1-e1685612604133.jpg\",\"width\":2000,\"height\":1334},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/devoteam.info\\\/en-se\\\/expert-view\\\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/devoteam.info\\\/en-se\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Expert View\",\"item\":\"https:\\\/\\\/devoteam.info\\\/en-se\\\/expert-view\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Optimise Your Data Warehouse: BigQuery Nested and Repeated Fields\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/devoteam.info\\\/en-se\\\/#website\",\"url\":\"https:\\\/\\\/devoteam.info\\\/en-se\\\/\",\"name\":\"Devoteam\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/devoteam.info\\\/en-se\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-SE\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Optimise Your Data Warehouse: BigQuery Nested Fields","description":"Optimise your BigQuery data warehouse with nested fields for faster queries and lower costs. Learn from our expert!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/devoteam.info\/en-se\/expert-view\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\/","og_locale":"en_US","og_type":"article","og_title":"Optimise Your Data Warehouse: BigQuery Nested and Repeated Fields","og_description":"Optimise your BigQuery data warehouse with nested fields for faster queries and lower costs. Learn from our expert!","og_url":"https:\/\/devoteam.info\/en-se\/expert-view\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\/","og_site_name":"Devoteam","article_modified_time":"2025-09-15T13:46:37+00:00","og_image":[{"width":1200,"height":627,"url":"https:\/\/devoteam.info\/wp-content\/uploads\/2025\/02\/Copy-of-Social-media.Nested-Fields.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/devoteam.info\/en-se\/expert-view\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\/","url":"https:\/\/devoteam.info\/en-se\/expert-view\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\/","name":"Optimise Your Data Warehouse: BigQuery Nested Fields","isPartOf":{"@id":"https:\/\/devoteam.info\/en-se\/#website"},"primaryImageOfPage":{"@id":"https:\/\/devoteam.info\/en-se\/expert-view\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\/#primaryimage"},"image":{"@id":"https:\/\/devoteam.info\/en-se\/expert-view\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\/#primaryimage"},"thumbnailUrl":"https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133.jpg","datePublished":"2025-02-17T11:00:19+00:00","dateModified":"2025-09-15T13:46:37+00:00","description":"Optimise your BigQuery data warehouse with nested fields for faster queries and lower costs. Learn from our expert!","breadcrumb":{"@id":"https:\/\/devoteam.info\/en-se\/expert-view\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\/#breadcrumb"},"inLanguage":"en-SE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/devoteam.info\/en-se\/expert-view\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\/"]}]},{"@type":"ImageObject","inLanguage":"en-SE","@id":"https:\/\/devoteam.info\/en-se\/expert-view\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\/#primaryimage","url":"https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133.jpg","contentUrl":"https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133.jpg","width":2000,"height":1334},{"@type":"BreadcrumbList","@id":"https:\/\/devoteam.info\/en-se\/expert-view\/optimise-your-data-warehouse-bigquery-nested-and-repeated-fields\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/devoteam.info\/en-se\/"},{"@type":"ListItem","position":2,"name":"Expert View","item":"https:\/\/devoteam.info\/en-se\/expert-view\/"},{"@type":"ListItem","position":3,"name":"Optimise Your Data Warehouse: BigQuery Nested and Repeated Fields"}]},{"@type":"WebSite","@id":"https:\/\/devoteam.info\/en-se\/#website","url":"https:\/\/devoteam.info\/en-se\/","name":"Devoteam","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/devoteam.info\/en-se\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-SE"}]}},"uagb_featured_image_src":{"full":["https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133.jpg",2000,1334,false],"thumbnail":["https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133-150x150.jpg",150,150,true],"medium":["https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133-300x200.jpg",300,200,true],"medium_large":["https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133-768x512.jpg",768,512,true],"large":["https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133-1024x683.jpg",1024,683,true],"1536x1536":["https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133-1536x1025.jpg",1536,1025,true],"2048x2048":["https:\/\/devoteam.info\/wp-content\/uploads\/2024\/12\/Data-Driven-Intelligence-1-e1685612604133.jpg",2000,1334,false]},"uagb_author_info":{"display_name":"uk.emma","author_link":"https:\/\/devoteam.info\/en-se\/author\/"},"uagb_comment_info":0,"uagb_excerpt":"Part 2 of BigQuery Optimisation series! Learn about the advantages of using nested and repeated fields in BigQuery.","_links":{"self":[{"href":"https:\/\/devoteam.info\/en-se\/wp-json\/wp\/v2\/expert-view\/553412","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devoteam.info\/en-se\/wp-json\/wp\/v2\/expert-view"}],"about":[{"href":"https:\/\/devoteam.info\/en-se\/wp-json\/wp\/v2\/types\/expert-view"}],"version-history":[{"count":0,"href":"https:\/\/devoteam.info\/en-se\/wp-json\/wp\/v2\/expert-view\/553412\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devoteam.info\/en-se\/wp-json\/wp\/v2\/media\/360259"}],"wp:attachment":[{"href":"https:\/\/devoteam.info\/en-se\/wp-json\/wp\/v2\/media?parent=553412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devoteam.info\/en-se\/wp-json\/wp\/v2\/categories?post=553412"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devoteam.info\/en-se\/wp-json\/wp\/v2\/tags?post=553412"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/devoteam.info\/en-se\/wp-json\/wp\/v2\/industry?post=553412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}