Using pagination with the BigQuery API

This document describes how to read table data and query results in large datasets by using pagination with the BigQuery API.

With pagination, BigQuery breaks a large dataset into smaller chunks called pages. For most users, Cloud Client Libraries handle this process automatically, but you can also manually control pagination for specific use cases like web applications.

Use automatic pagination

Cloud Client Libraries handle the low-level details of API pagination and provide an iterator-like experience. When you iterate through results, the library automatically fetches the next page of data when it's needed.

The following samples demonstrate how to automatically iterate through BigQuery table data.

C#

Before trying this sample, follow the C# setup instructions in the BigQuery quickstart using client libraries. For more information, see the BigQuery C# API reference documentation.

To authenticate to BigQuery, set up Application Default Credentials. For more information, see Set up authentication for client libraries.


using Google.Api.Gax;
using Google.Apis.Bigquery.v2.Data;
using Google.Cloud.BigQuery.V2;
using System;
using