이 문서에서는 BigQuery의 저장된 쿼리를 소개합니다.
저장된 쿼리를 사용하여 SQL 스크립트를 만들고 관리할 수 있습니다. 저장된 쿼리의 변경사항은 자동으로 저장되므로 쿼리 편집기를 닫을 때 작업 내용을 잃지 않습니다.
저장된 쿼리는 다음 옵션을 통해 공동작업 및 쿼리 관리를 개선합니다.
Identity and Access Management(IAM)를 사용하여 특정 사용자 및 그룹과 저장된 쿼리 공유
쿼리 버전 기록 검토
이전 버전의 쿼리로 되돌리거나 브랜치 만들기
저장된 쿼리는 Dataform으로 구동되는 BigQuery Studio 코드 애셋입니다.
노트북도 코드 애셋입니다. 모든 코드 애셋은 기본 리전에 저장됩니다. 기본 리전을 업데이트하면 해당 시점 이후에 생성된 모든 코드 애셋의 리전이 변경됩니다.
저장된 쿼리 기능은 Google Cloud 콘솔에서만 사용할 수 있습니다.
저장된 쿼리 보안
Identity and Access Management(IAM) 역할을 사용하여 저장된 쿼리에 대한 액세스를 제어합니다.
자세한 내용은 저장된 쿼리 공유를 참조하세요.
지원되는 리전
BigQuery Studio를 사용하면 저장된 쿼리를 저장, 공유, 관리할 수 있습니다. 다음 표에는 BigQuery Studio를 사용할 수 있는 리전이 나와 있습니다.
Google Cloud 프로젝트에 기존 저장된 쿼리가 2,500개를 초과하는 경우 일괄 마이그레이션을 사용하여 기존 저장된 쿼리를 저장된 쿼리로 마이그레이션할 수 없습니다.
기존 저장된 쿼리
기존 저장된 쿼리는 SQL 쿼리를 저장하고 공유하기 위해 이전에 사용하던 방법입니다.
기존 저장된 쿼리는 쿼리 텍스트를 제공하며, 기존 저장된 쿼리로 유지되는 유일한 쿼리 설정은 SQL 버전입니다. 이 설정은 쿼리가 legacy SQL 또는 GoogleSQL을 사용하는지 여부를 제어합니다. 데이터를 쿼리하려면 사용자에게 저장된 쿼리가 액세스하는 데이터에 대한 액세스 권한이 있어야 합니다.
탐색기 창의 (기존)쿼리 폴더에서 기존 저장된 쿼리를 확인할 수 있습니다.
저장된 기본 쿼리의 유형은 3가지입니다.
개인을 선택합니다. 쿼리를 만드는 사용자만 기존 저장된 개인 쿼리를 볼 수 있습니다. person 아이콘으로 식별됩니다.
프로젝트 수준. 프로젝트 수준의 저장된 쿼리는 필요한 권한이 있는 주 구성원에게 표시됩니다.
people 아이콘으로 식별됩니다.
공개. 쿼리 링크가 있는 모든 사용자가 저장된 공개 기본 쿼리를 볼 수 있습니다. share 아이콘으로 식별됩니다.
기존 저장된 쿼리를 저장된 쿼리에 마이그레이션하여 새 기능을 활용하거나, 지원 중단까지 기존 저장된 쿼리로 계속해서 유지할 수 있습니다. 지원 중단 타임라인을 검토하는 중입니다.
기존 저장된 쿼리 기능은Google Cloud 콘솔에서만 사용할 수 있습니다.
기존 저장된 쿼리 지원 중단
BigQuery Studio의 저장된 쿼리 기능이 기존 저장된 쿼리를 대체합니다. 지원 중단 타임라인을 검토하는 중입니다. 지원 중단 이후에 기존 저장된 쿼리를 수정하려면 BigQuery Studio 저장된 쿼리로 기존 쿼리를 마이그레이션해야 합니다.
본인을 포함한 사용자가 프로젝트의 데이터에 액세스할 수 있는 다른 사용자에게 제공해서는 안 되는 정보가 포함된 개인 쿼리를 사용하는 경우 쿼리 소유자는 마이그레이션을 완료할 때까지 쿼리나 정보를 삭제해야 합니다.
이 전환을 지원하기 위해 2024년 2월에 다음 BigQuery IAM 역할이 업데이트되었습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eSaved queries in BigQuery allow users to create and manage SQL scripts, enhancing collaboration through options like sharing and version history.\u003c/p\u003e\n"],["\u003cp\u003eThese queries, which are code assets within BigQuery Studio and powered by Dataform, save both the query text and settings, and are stored in a default region that can be updated.\u003c/p\u003e\n"],["\u003cp\u003eAccess to saved queries is controlled using Identity and Access Management (IAM) roles, and they are only available in the Google Cloud console.\u003c/p\u003e\n"],["\u003cp\u003eClassic saved queries, which are an earlier version of the feature, will be fully replaced by BigQuery Studio saved queries in the future, and are deprecated.\u003c/p\u003e\n"],["\u003cp\u003eThe migration from classic saved queries to BigQuery Studio saved queries is recommended to leverage the latest features and will be needed in the future due to deprecation.\u003c/p\u003e\n"]]],[],null,["# Introduction to saved queries\n=============================\n\nThis document provides an introduction to saved queries in BigQuery.\nYou can use saved queries to create and manage SQL scripts. Changes to a saved\nquery are automatically saved so that you don't lose your work when you close\nthe query editor.\nSaved queries improve collaboration and query management with the following\noptions:\n\n- [Share saved queries](/bigquery/docs/work-with-saved-queries#share-saved-query) with specific users and groups by using Identity and Access Management (IAM).\n- Review the query version history.\n- Revert to or branch from previous versions of the query.\n\nSaved queries are\n[BigQuery Studio](/bigquery/docs/query-overview#bigquery-studio)\ncode assets powered by [Dataform](/dataform/docs/overview).\n[Notebooks](/bigquery/docs/notebooks-introduction) are also code assets. All\ncode assets are stored in a default\n[region](#supported_regions). Updating the default region changes\nthe region for all code assets created after that point.\n\nSaved query capabilities are available only in the Google Cloud console.\n\n### Saved query security\n\nYou control access to saved queries by using Identity and Access Management (IAM) roles.\nFor more information, see\n[Share saved queries](/bigquery/docs/work-with-saved-queries#share-saved-query).\n\n### Supported regions\n\nBigQuery Studio lets you save, share, and manage saved queries. The\nfollowing table lists the regions where BigQuery Studio is available:\n\n### Quotas and limits\n\nFor more information, see\n[Saved query quotas and limits](/bigquery/quotas#saved_query_limits).\n\n### Limitations\n\nSaved queries have the following limitations:\n\n- You can [grant public access to saved queries](/bigquery/docs/manage-saved-queries#grant-public-access) only to the [`allAuthenticatedUsers`](/iam/docs/principals-overview#all-authenticated-users) principal. You can't grant access to saved queries to the [`allUsers`](/iam/docs/principals-overview#all-users) principal.\n- If your Google Cloud project contains more than 2500 classic saved queries, you can't use [batch migration](/bigquery/docs/manage-saved-queries#migrate_classic_saved_queries) to migrate classic saved queries to saved queries.\n\nClassic saved queries\n---------------------\n\n| **Deprecated:** Saved queries, available in [BigQuery Studio](/bigquery/docs/enable-assets), will fully replace classic saved queries in the future. The deprecation timeline is being reviewed. For more information, see [Deprecation of classic saved queries](/bigquery/docs/saved-queries-introduction#classic-saved-queries-deprecation). To learn how to migrate to saved queries, see [Migrate classic saved queries](/bigquery/docs/manage-saved-queries#migrate_classic_saved_queries).\n\nClassic saved queries are an earlier way of saving and sharing SQL queries.\nClassic saved queries provide the query text, and the only query setting\nretained by a classic saved query is the SQL version. This setting\ngoverns whether the query uses legacy SQL or GoogleSQL. To\nquery the data, users must have access to the data that the saved query\naccesses.\n\nYou can see classic saved queries in the **(Classic) Queries** folder of the\n**Explorer** pane:\n\n| **Note:** If you have not enabled BigQuery Studio, classic saved queries appear in the **Saved queries (\u003cvar translate=\"no\"\u003eNUMBER\u003c/var\u003e)** folder of the **Explorer** pane instead of the **(Classic) Queries** folder.\n\nThere are 3 types of classic saved queries:\n\n- **Personal.** Personal classic saved queries are visible only to the user who creates them. They are identified with the person icon.\n- **Project-level.** Project-level saved queries are visible to principals that have the required [permissions](/bigquery/docs/work-with-saved-queries#required_permissions_for_classic_saved_queries). They are identified with the people icon.\n- **Public.** Public classic saved queries are visible to anyone with a link to the query. They are identified with the share icon.\n\nYou can\n[migrate](/bigquery/docs/manage-saved-queries#migrate_classic_saved_queries)\nclassic saved queries to saved queries to take advantage of the new\ncapabilities, or\n[continue to maintain them](/bigquery/docs/work-with-saved-queries#update_classic_saved_queries)\nas classic saved queries until deprecation. The timeline for deprecation is being reviewed.\n\nThe classic saved query feature is available only in the\nGoogle Cloud console.\n\nDeprecation of classic saved queries\n------------------------------------\n\nThe saved queries feature of\n[BigQuery Studio](/bigquery/docs/enable-assets)\nwill replace classic saved queries. The deprecation timeline is being reviewed. To edit existing classic saved queries\nafter deprecation, you must\n[migrate classic queries](/bigquery/docs/manage-saved-queries#migrate_classic_saved_queries)\nto BigQuery Studio saved queries.\n\nIf users, including yourself, have personal queries with\ninformation that shouldn't be made available to others with access to data in\nthe project, then the query's owner must delete the queries or the information\nbefore completing the migration.\n\nTo support this transition, the following BigQuery IAM\nroles were updated in February 2024:\n\n- **[BigQuery Admin (`roles/bigquery.admin`)](/iam/docs/understanding-roles#bigquery.admin)**\n will get\n [Dataform Admin (`roles/dataform.admin`)](/iam/docs/understanding-roles#dataform.admin)\n permissions.\n\n- **[BigQuery Job User (`roles/bigquery.jobUser`)](/iam/docs/understanding-roles#bigquery.jobUser)**\n will get the following permissions:\n\n - `dataform.locations.get`\n - `dataform.locations.list`\n - `dataform.repositories.create`\n - `dataform.repositories.list`\n- **[BigQuery User (`roles/bigquery.user`)](/iam/docs/understanding-roles#bigquery.user)**\n will get the following permissions:\n\n - `dataform.locations.get`\n - `dataform.locations.list`\n - `dataform.repositories.create`\n - `dataform.repositories.list`\n\nTo let users without the BigQuery Admin, BigQuery Job User, or BigQuery User\nroles use saved queries, grant them\nthe [required permissions](/bigquery/docs/work-with-saved-queries#required_permissions)\nin IAM.\n\n[Custom roles](/bigquery/docs/access-control#bigquery-custom-roles) won't be\nautomatically updated. To update a custom role with\nthe [required permissions](/bigquery/docs/work-with-saved-queries#required_permissions),\nsee [Edit an existing custom role](/iam/docs/creating-custom-roles#edit-role).\n\nWhat's next\n-----------\n\n- To learn how to create saved queries, see [Create saved queries](/bigquery/docs/work-with-saved-queries).\n- To learn how to manage saved queries, see [Manage saved queries](/bigquery/docs/manage-saved-queries)."]]