Spanner용 PostgreSQL 인터페이스를 사용하면 익숙한 PostgreSQL 도구와 구문을 사용하여 Spanner의 확장 가능하고 가용성이 높은 완전 관리형 인프라를 활용할 수 있습니다. 이 페이지는 PostgreSQL 인터페이스의 기능과 제한사항을 이해하는 데 도움이 됩니다.
PostgreSQL 인터페이스의 이점
이식성: PostgreSQL 인터페이스는 오픈소스 PostgreSQL과 호환되는 스키마, 쿼리, 클라이언트를 사용하여 다양한 Spanner 기능에 대한 액세스 권한을 제공합니다. 이를 통해 Spanner에서 빌드된 애플리케이션을 다른 PostgreSQL 환경으로 이전하는 과정이 간소화됩니다. 이러한 이식성은 배포 유연성을 제공하고 비상시 출구 전략과 같은 재해 복구 시나리오를 지원합니다.
기본 지식: 이미 PostgreSQL을 사용하고 있는 경우 동일한 PostgreSQL 문과 도구를 많이 사용하여 Spanner를 빠르게 시작할 수 있습니다. 데이터베이스 포트폴리오 전반에서 PostgreSQL을 사용하면 특정 제품과 공통 권장사항 간에 차이가 줄어듭니다.
타협하지 않는 Spanner: PostgreSQL 인터페이스는 Spanner의 기존 기반을 기반으로 하므로 보완적인 GoogleSQL 생태계에서 제공되는 기능을 저하시키지 않고도 Spanner의 기존 가용성, 일관성, 가격 대비 성능 이점을 모두 제공합니다.
Spanner에서 지원되지 않는 PostgreSQL 기능
PostgreSQL 인터페이스는 PostgreSQL과 호환되는 스키마, 유형, 쿼리, 클라이언트를 통해 Spanner의 기능을 제공한다는 점을 이해하는 것이 중요합니다. PostgreSQL의 일부 기능은 지원되지 않습니다. 기존 PostgreSQL 애플리케이션을 Spanner로 마이그레이션하려면 Spanner용 PostgreSQL 인터페이스를 사용하더라도 지원되지 않는 PostgreSQL 기능이나 동작의 차이(예: 쿼리 최적화 또는 기본 키 설계)를 수용하기 위해 약간의 재작업이 필요할 수 있습니다. 하지만 일단 마이그레이션되면 워크로드에서 Spanner의 안정성과 고유한 다중 모델 기능을 활용할 수 있습니다.
다음 목록에는 지원되는 PostgreSQL 기능과 지원되지 않는 PostgreSQL 기능에 관한 자세한 내용이 나와 있습니다.
지원되는 PostgreSQL 기능: PostgreSQL 인터페이스는 가장 흔히 사용되는 많은 PostgreSQL 기능을 지원합니다. 여기에는 스키마 및 유형 시스템의 핵심 부분, 여러 일반적인 쿼리 형태, 다양한 함수 및 연산자, PostgreSQL 시스템 카탈로그의 주요 측면이 포함됩니다. 애플리케이션은 Spanner의 PostgreSQL 유선 프로토콜 구현을 통해 연결하여 많은 PostgreSQL 클라이언트를 사용할 수 있습니다.
지원되지 않는 PostgreSQL 언어 기능: 확장 프로그램, 사용자 정의 데이터 유형, 사용자 정의 저장 프로시저, 기타 기능이 지원되지 않습니다. 전체 목록은 Spanner의 PostgreSQL 언어를 참조하세요.
PostgreSQL에는 오픈소스 PostgreSQL과 다르게 작동하는 몇 가지 기능도 있습니다. 자세한 내용은 Spanner용 PostgreSQL 인터페이스의 알려진 문제를 참조하세요.
Spanner 및 Spanner 컨트롤 플레인: PostgreSQL 인터페이스가 있는 데이터베이스는 Spanner 및 Google Cloud도구를 사용하여 인스턴스를 프로비저닝, 보호, 모니터링, 최적화합니다.
Spanner는 관리 활동을 위한 pgAdmin과 같은 도구를 지원하지 않습니다.
클라이언트 및 유선 프로토콜 지원: Spanner는 애플리케이션과 함께 실행되는 간단한 프록시인 PGAdapter를 사용하여 PostgreSQL 유선 프로토콜의 핵심 쿼리 기능을 지원합니다. 이를 통해 많은 Spanner 클라이언트가 Spanner PostgreSQL 인터페이스 데이터베이스를 있는 그대로 사용하면서 Spanner의 전역 엔드포인트 및 연결 관리와 IAM 인증을 활용할 수 있습니다. Google의 내부 벤치마킹에 따르면 PGAdapter는 Spanner의 기본 제공 엔드포인트에 직접 연결하는 것과 비교하여 눈에 띄는 지연 시간을 추가하지 않는 것으로 나타났습니다.
운영 및 관리
PostgreSQL 인터페이스는 다음과 같은 기능으로 Spanner 데이터베이스의 관리를 지원합니다.
통합 환경: Spanner의 기존 콘솔, API, 도구(예: Google Cloud CLI)를 사용하여 PostgreSQL 인터페이스 지원 데이터베이스를 프로비저닝, 관리, 모니터링합니다.
유연한 구성: 생성 시 데이터베이스별로 PostgreSQL 인터페이스를 구성합니다. 단일 Spanner 인스턴스에서 GoogleSQL 및 PostgreSQL 인터페이스 데이터베이스를 모두 수용할 수 있습니다.
공유 이점: 두 데이터베이스 언어 모두 동일한 기본 분산형 데이터베이스 엔진을 공유하므로 일관된 확장성, 일관성, 성능, 보안을 보장할 수 있습니다.
기능
Spanner의 PostgreSQL 인터페이스는 PostgreSQL 생태계와의 통합을 지원하는 두 가지 기본 기능을 제공합니다.
PostgreSQL 언어 지원
Spanner는 데이터 쿼리 언어(DQL), 데이터 조작 언어(DML), 데이터 정의 언어(DDL)를 비롯한 PostgreSQL SQL 언어의 하위 집합을 제공합니다. 또한 인터리브 처리된 테이블, TTL(수명), 쿼리 힌트와 같은 Spanner 관련 기능을 지원하는 확장 프로그램도 포함되어 있습니다.
지원되는 PostgreSQL 언어 요소에 대한 자세한 내용은 Spanner의 PostgreSQL 언어를 참조하세요. PostgreSQL 언어로 Spanner 기능을 사용하는 방법을 알아보려면 특정 기능에 관한 문서를 참조하세요.
[[["이해하기 쉬움","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-05(UTC)"],[],[],null,["# PostgreSQL interface\n\nThe PostgreSQL interface for Spanner lets you take advantage of\nSpanner's fully managed, scalable, and highly available\ninfrastructure using familiar PostgreSQL tools and syntax. This page\nhelps you understand the capabilities and limitations of the PostgreSQL\ninterface.\n\nBenefits of the PostgreSQL interface\n------------------------------------\n\n- **Portability**: the PostgreSQL interface provides access to the breadth of Spanner features, using schemas, queries, and clients that are compatible with open source PostgreSQL. This simplifies moving an application built on Spanner to another PostgreSQL environment. This portability provides deployment flexibility and supports disaster recovery scenarios, such as a stressed exit.\n- **Familiarity**: if you already use PostgreSQL, you can quickly get started with Spanner using many of the same PostgreSQL statements and tools. Using PostgreSQL across your database portfolio means fewer variations between specific products and a common set of best practices.\n- **Uncompromisingly Spanner**: because it's built on Spanner's existing foundation, the PostgreSQL interface provides all of Spanner's existing availability, consistency, and price-performance benefits without having to compromise on any of the capabilities available in the complementary GoogleSQL ecosystem.\n\nUnsupported PostgreSQL features on Spanner\n------------------------------------------\n\nIt's important to understand that the PostgreSQL interface\nprovides the capabilities of Spanner through schemas, types,\nqueries, and clients that are compatible with PostgreSQL. It doesn't\nsupport all of the features of PostgreSQL. Migrating an existing\nPostgreSQL application to Spanner, even using\nthe PostgreSQL interface for Spanner, likely requires some rework to accommodate\nunsupported PostgreSQL capabilities or differences in behavior, like\nquery optimization or primary key design. However, once it's migrated, your\nworkloads can take advantage of Spanner's reliability and unique\nmulti-model capabilities.\n\nThe following list provides more information on supported and unsupported\nPostgreSQL features:\n\n- **Supported PostgreSQL functionality**: the PostgreSQL interface supports many of the most commonly used features of PostgreSQL. This includes core parts of the schema and type system, many common query shapes, a variety of functions and operators, and the key aspects of PostgreSQL's system catalog. Applications can use many PostgreSQL clients by connecting over Spanner's implementation of the PostgreSQL wire protocol.\n- **Some PostgreSQL language features aren't supported** : extensions, user-defined data types, user-defined stored procedures, and other features aren't supported. For a complete list, see [The PostgreSQL language in Spanner](/spanner/docs/reference/postgresql/overview). There are also some features in PostgreSQL that behave differently from open source PostgreSQL. For more information, see [Known issues in the PostgreSQL interface for Spanner](/spanner/docs/reference/postgresql/known-issues-postgresql-interface).\n- **Spanner and Spanner control plane**: databases with PostgreSQL interfaces use Spanner and Google Cloud tools to provision, secure, monitor, and optimize instances. Spanner doesn't support tools, such as pgAdmin for administrative activities.\n- **Client and wire protocol support**: Spanner supports the core query capabilities of the PostgreSQL wire protocol using PGAdapter, a lightweight proxy that runs alongside your application. This lets many Spanner clients work as-is with a Spanner PostgreSQL interface database, while leveraging Spanner's global endpoint and connection management and IAM authentication. Google's internal benchmarking shows that PGAdapter doesn't add any noticeable additional latency compared to direct connection to Spanner's built-in endpoints.\n\nAdministration and Management\n-----------------------------\n\nThe PostgreSQL interface supports the administration and\nmanagement of your Spanner databases with the following features:\n\n- **Unified experience**: provision, manage, and monitor PostgreSQL interface-enabled databases using Spanner's existing console, APIs, and tools like Google Cloud CLI.\n- **Flexible configuration**: configure the PostgreSQL interface per database at creation time. A single Spanner instance can accommodate both GoogleSQL and PostgreSQL interface databases.\n- **Shared benefits**: both database dialects share the same underlying distributed database engine, ensuring consistent scalability, consistency, performance, and security.\n\nFeatures\n--------\n\nSpanner's PostgreSQL interface offers two primary\nfeatures that enable integration with the PostgreSQL ecosystem:\n\n- **PostgreSQL dialect support**\n\n Spanner provides a subset of the PostgreSQL SQL\n dialect, including Data Query Language (DQL), Data Manipulation Language\n (DML), and Data Definition Language (DDL). Additionally, it includes\n extensions to support Spanner-specific features like\n [interleaved tables](/spanner/docs/schema-and-data-model#parent-child),\n [time to live (TTL)](/spanner/docs/ttl), and [query hints](/spanner/docs/reference/postgresql/query-syntax#pg_extensions).\n\n For detailed information on the supported PostgreSQL language\n elements, see [The PostgreSQL language in\n Spanner](/spanner/docs/reference/postgresql/overview). To\n understand how to use Spanner features with the\n PostgreSQL dialect, consult the documentation for the specific\n feature.\n- **PostgreSQL client support**\n\n Spanner lets you connect to databases from a variety of\n clients:\n - **PostgreSQL ecosystem tools:** you can use familiar\n tools like the [PostgreSQL JDBC driver](/spanner/docs/pg-jdbc-connect)\n and [PostgreSQL pgx driver](https://github.com/jackc/pgx) to connect\n your applications to a PostgreSQL interface database. For\n a list of supported drivers, ORMs, and tools see\n [PostgreSQL drivers and ORMs](/spanner/docs/drivers-overview#postgresql-drivers-and-orms).\n\n - **psql command-line tool** : the popular\n [`psql` interactive environment](/spanner/docs/psql-commands)\n is supported, letting you run queries, explore metadata, and load data\n directly from your terminal.\n\n - **PGAdapter:** this lightweight proxy simplifies connection\n management and authentication. For more details, refer to the [PGAdapter overview](/spanner/docs/pgadapter).\n\n - **Spanner clients:** Spanner provides\n open source Spanner clients for various programming\n languages (Java, Go, Python, Node.js, Ruby, PHP, C#, C++), along with a\n [Spanner JDBC driver](https://github.com/googleapis/java-spanner-jdbc)\n and a [driver for Go's SQL package](https://github.com/googleapis/go-sql-spanner).\n Spanner clients connect directly to\n Spanner's global endpoint without a proxy. However,\n Spanner clients don't offer compatibility with existing\n PostgreSQL clients, ORMs, or tools.\n\nBest practices for using the PostgreSQL interface\n-------------------------------------------------\n\nUse the following best practices when using the PostgreSQL interface:\n\n1. **Connect your applications** : use the [set of supported PostgreSQL\n tools](#connect-pg) for efficient connectivity.\n2. **Interact with your database**: for interactive work, choose\n between the following:\n\n - The familiar [psql command-line tool](/spanner/docs/psql-connect) (using the [PGAdapter proxy](/spanner/docs/pgadapter-get))\n - The intuitive [Spanner Studio](/spanner/docs/manage-data-using-console) page within the Google Cloud console\n - IDEs, such [DBeaver](https://cloud.google.com/blog/topics/developers-practitioners/exploring-cloud-spanner-data-dbeaver/) and [Visual Studio Code](https://cloud.google.com/blog/topics/developers-practitioners/browse-and-query-cloud-spanner-databases-visual-studio-code), [JetBrains](https://cloud.google.com/blog/topics/developers-practitioners/cloud-spanner-connectivity-using-jetbrains-ides), and [IntelliJ](/spanner/docs/use-intellij)\n - The Spanner emulator which lets you emulate Spanner on your local machine. This is useful during the development and test process.\n\n### What's next\n\n- Learn how to [choose between PostgreSQL and\n GoogleSQL](/spanner/docs/choose-googlesql-or-postgres).\n- Follow the [quickstart](/spanner/docs/create-query-database-console) to create and interact with a PostgreSQL database.\n- Learn more about [Spanner's PostgreSQL language\n support](/spanner/docs/reference/postgresql/overview).\n- Learn about [PGAdapter](/spanner/docs/pgadapter).\n- Learn about the [PGAdapter GitHub\n repository](https://github.com/GoogleCloudPlatform/pgadapter).\n- Review [known issues](/spanner/docs/known-issues-postgresql-interface) in the PostgreSQL interface."]]