Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downloading tables takes longer when api = "arrow" #622

Open
botan opened this issue Oct 19, 2024 · 0 comments
Open

Downloading tables takes longer when api = "arrow" #622

botan opened this issue Oct 19, 2024 · 0 comments

Comments

@botan
Copy link

botan commented Oct 19, 2024

Downloading tables with bq_download_table(api = "arrow") instead of bq_download_table(api = "json") for large-size tables, the Arrow table streams slower than fetching and parsing JSON.

The example below requires bigquery-public-data.usa_names.usa_1910_current table to be copied to your project.

library(bigrquerystorage)
library(bigrquery)
library(tictoc)

billing <- Sys.getenv("GCP_BILLING_PROJECT_ID")

tic()
bigquery_storage_api_rows <-
  bq_project_query(
    billing,
    "
    select name, number, state
      from usa_names.usa_1910_current
     where state = 'WA'
    "
  ) |> 
  bq_table_download(api = "arrow")
toc()
#> Job complete
#> Billed: 125.83 MB
#> Streamed 130809 rows in 32 messages. 
#> 82.522 sec elapsed

tic()
bigquery_api_rows <-
  bq_project_query(
    billing,
    "
    select name, number, state
      from usa_names.usa_1910_current
     where state = 'WA'
    "
  ) |> 
  bq_table_download(api = "json")
toc()
#> Job complete
#> Billed: 0 B
#> Downloading first chunk of data.
#> First chunk includes all requested rows.
#> 3.953 sec elapsed
@botan botan changed the title Downloading tables takes longer when the BigQuery Storage Read API is used Downloading tables takes longer when api = "arrow" Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant