Spanner 是一项全托管式关键任务数据库服务,整合了关系型、图表、键值对和搜索数据库。它可提供全球范围的事务一致性、自动同步复制功能以实现高可用性,以及对两种 SQL 方言的支持:GoogleSQL(ANSI 2011 及扩展程序)和 PostgreSQL。
不确定哪种数据库方案适合您?请详细了解我们的数据库服务。
获享 $300 免费赠金开始概念验证
-
体验 Gemini 2.0 Flash Thinking
-
免费使用热门产品(包括 AI API 和 BigQuery)的每月用量
-
不会自动收费,无需承诺
继续探索 20 多种提供“始终免费”用量的产品
使用适用于常见应用场景(包括 AI API、虚拟机、数据仓库等)的 20 多种免费产品。
培训
培训和教程
Google Cloud 基础知识:核心基础架构
这些讲座、演示和实操实验概述了 Google Cloud 产品和服务,以便您了解 Google Cloud 的价值,以及如何将云端解决方案整合到您的业务策略中。
培训
培训和教程
Google Cloud 架构设计:设计和流程
本课程包含讲座、设计活动和实操实验,旨在为您介绍如何在 Google Cloud 上使用经过验证的设计模式来构建高度可靠且高效的解决方案,以及如何运营可用性高且经济实惠的部署。
培训
培训和教程
带 Spring Boot 的 Spanner
了解如何从 Cloud Run 连接到 Cloud SQL
使用场景
使用场景
为受限于位置的工作负载设计灾难恢复架构
了解如何使用 Google Cloud 设计灾难恢复 (DR) 架构以满足特定于位置的要求。
灾难恢复
使用场景
使用场景
使用 Striim 将数据持续复制到 Spanner
演示了如何使用 Striim 将 MySQL 数据库迁移到 Spanner。
复制
迁移
使用场景
使用场景
数据库迁移:概念和原则(第 1 部分)
介绍接近零停机时间数据库迁移到 Google Cloud 的概念、原则、术语和架构。
迁移
使用场景
使用场景
使用 Spanner 的提交时间戳功能通过 JDBC 创建更改日志
展示如何使用提交时间戳功能来跟踪更改数据库记录的日期和时间。
Java
更改
使用场景
使用场景
将 Spanner 用作游戏数据库的最佳做法
介绍将 Spanner 用作游戏状态存储的主要后端数据库的最佳实践。
分片
游戏
代码示例
代码示例
Spanner 使用入门 (Python)
在 Python 应用中使用 Spanner 的初始步骤
代码示例
代码示例
Spanner 使用入门 (Node.js)
将 Spanner 与 Nde.js 搭配使用的初始步骤
代码示例
代码示例
Spanner 使用入门 (Java)
在 Java 中使用 Spanner 的初始步骤
代码示例
代码示例
Spanner 使用入门 (PHP)
在 PHP 中使用 Spanner 的初始步骤
代码示例
代码示例
Spanner 使用入门 (C#)
在 Spanner 中使用 Spanner 的初始步骤
代码示例
代码示例
Spanner 使用入门 (Ruby)
在 Ruby 中使用 Spanner 的初始步骤
代码示例
代码示例
Spanner 使用入门 (C++)
在 C++ 中使用 Spanner 的初始步骤
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-21。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-21。"],[],[],null,["# Spanner documentation\n=====================\n\n[Read product documentation](/spanner/docs/getting-started/set-up)\nSpanner is a fully managed, mission-critical database\nservice that brings together relational, graph, key-value, and search. It offers transactional\nconsistency at global scale, automatic, synchronous replication for high availability, and support\nfor two SQL dialects: GoogleSQL (ANSI 2011 with extensions) and PostgreSQL.\n\n\nNot sure what database option is right for you? Learn more about our\n[database services](/products/databases).\n[Get started for free](https://console.cloud.google.com/freetrial) \n\n#### Start your proof of concept with $300 in free credit\n\n- Get access to Gemini 2.0 Flash Thinking\n- Free monthly usage of popular products, including AI APIs and BigQuery\n- No automatic charges, no commitment \n[View free product offers](/free/docs/free-cloud-features#free-tier) \n\n#### Keep exploring with 20+ always-free products\n\n\nAccess 20+ free products for common use cases, including AI APIs, VMs, data warehouses,\nand more.\n\nDocumentation resources\n-----------------------\n\nFind quickstarts and guides, review key references, and get help with common issues. \nformat_list_numbered\n\n### Guides\n\n-\n\n [Quickstart: Create and query a database by using the Google Cloud console](/spanner/docs/create-query-database-console)\n\n-\n\n [Create and manage instances](/spanner/docs/create-manage-instances)\n\n-\n\n [Choose GoogleSQL or PostgreSQL Google Cloud console](/spanner/docs/choose-googlesql-or-postgres)\n\n-\n\n [Import and export data in CSV format](/spanner/docs/import-export-csv)\n\n-\n\n [Create and manage foreign key relationships](/spanner/docs/foreign-keys/how-to)\n\n-\n\n [Insert, update, and delete data using Data Manipulation Language (DML)](/spanner/docs/dml-tasks)\n\n-\n\n [Insert, update, and delete data using mutations](/spanner/docs/modify-mutation-api)\n\n-\n\n [Use the Dataflow connector](/spanner/docs/dataflow-connector)\n\n-\n\n [Set up and query Spanner Graph using the Google Cloud console](/spanner/docs/graph/set-up)\n\n-\n\n [Monitor instances with Cloud Monitoring](/spanner/docs/monitoring-cloud)\n\n-\n\n [Emulate Spanner locally](/spanner/docs/emulator)\n\n-\n\n [Troubleshoot performance regressions](/spanner/docs/troubleshooting-performance-regressions)\n\nfind_in_page\n\n### Reference\n\n-\n\n [Client libraries and drivers](/spanner/docs/reference/libraries)\n\n-\n\n [REST API](/spanner/docs/reference/rest)\n\n-\n\n [RPC API](/spanner/docs/reference/rpc)\n\n-\n\n [GoogleSQL](/spanner/docs/reference/standard-sql/lexical)\n\n-\n\n [PostgreSQL](/spanner/docs/reference/postgresql/overview)\n\n-\n\n [Graph Query Language](/spanner/docs/reference/standard-sql/graph-intro)\n\n-\n\n [Information schema](/spanner/docs/information-schema)\n\n-\n\n [Query execution operators](/spanner/docs/query-execution-operators)\n\n-\n\n [gcloud command-line tool](/sdk/gcloud/reference/spanner)\n\ninfo\n\n### Resources\n\n-\n\n [Pricing](/spanner/pricing)\n\n-\n\n [Quotas and limits](/spanner/quotas)\n\n-\n\n [Release notes](/spanner/docs/release-notes)\n\n-\n\n [Get support](/spanner/docs/getting-support)\n\nRelated resources\n-----------------\n\nTraining and tutorials \nUse cases \nCode samples \nExplore self-paced training, use cases, reference architectures, and code samples with examples of how to use and connect Google Cloud services. Training \nTraining and tutorials\n\n### Google Cloud Fundamentals: Core Infrastructure\n\n\nThese lectures, demos, and hands-on labs give you an overview of Google Cloud products and services so that you can learn the value of Google Cloud and how to incorporate cloud-based solutions into your business strategies.\n\n\n[Learn more](/training/course/core-infrastructure) \nTraining \nTraining and tutorials\n\n### Architecting with Google Cloud: Design and Process\n\n\nThis course features a combination of lectures, design activities, and hands-on labs to show you how to use proven design patterns on Google Cloud to build highly reliable and efficient solutions and operate deployments that are highly available and cost-effective.\n\n\n[Learn more](/training/course/architecting-design-process) \nTraining \nTraining and tutorials\n\n### Spanner with Spring Boot\n\n\nLearn how to connect to Cloud SQL from Cloud Run\n\n\n[Learn more\narrow_forward](https://codelabs.developers.google.com/codelabs/cloud-spring-spanner) \nUse case \nUse cases\n\n### Architecting disaster recovery for locality-restricted workloads\n\n\nDiscusses how to use Google Cloud to architect for disaster recovery (DR) to meet location-specific requirements.\n\nDisaster Recovery\n\n\u003cbr /\u003e\n\n[Learn more](/solutions/architecting-disaster-recovery-for-locality-restricted-workloads) \nUse case \nUse cases\n\n### Continuous data replication to Spanner using Striim\n\n\nDemonstrates migrating a MySQL database to Spanner using Striim.\n\nReplication Migration\n\n\u003cbr /\u003e\n\n[Learn more](/solutions/partners/continuous-data-replication-cloud-spanner-striim) \nUse case \nUse cases\n\n### Database migration: Concepts and principles (Part 1)\n\n\nIntroduces concepts, principles, terminology, and architecture of near-zero downtime database migrations to Google Cloud.\n\nMigration\n\n\u003cbr /\u003e\n\n[Learn more](/solutions/database-migration-concepts-principles-part-1) \nUse case \nUse cases\n\n### Creating a change log with JDBC using the commit timestamp feature of Spanner\n\n\nShows how to use the commit timestamp feature to track the date and time when changes are made to your database records.\n\nJava Changes\n\n\u003cbr /\u003e\n\n[Learn more](/solutions/using-spanner-commit-timestamp) \nUse case \nUse cases\n\n### Best practices for using Spanner as a gaming database\n\n\nDescribes best practices for using Spanner as the primary backend database for game state storage.\n\nShards Gaming\n\n\u003cbr /\u003e\n\n[Learn more](/solutions/best-practices-cloud-spanner-gaming-database) \nCode sample \nCode Samples\n\n### Getting started with Spanner in Python\n\n\nFirst steps using Spanner with Python\n\n\n[Get started](/spanner/docs/getting-started/python) \nCode sample \nCode Samples\n\n### Getting started with Spanner in Node.js\n\n\nFirst steps using Spanner with Nde.js\n\n\n[Get started](/spanner/docs/getting-started/nodejs) \nCode sample \nCode Samples\n\n### Getting started with Spanner in Java\n\n\nFirst steps using Spanner with Java\n\n\n[Get started](/spanner/docs/getting-started/java) \nCode sample \nCode Samples\n\n### Getting started with Spanner in PHP\n\n\nFirst steps using Spanner with PHP\n\n\n[Get started](/spanner/docs/getting-started/php) \nCode sample \nCode Samples\n\n### Getting started with Spanner in C#\n\n\nFirst steps using Spanner with C#\n\n\n[Get started](/spanner/docs/getting-started/csharp) \nCode sample \nCode Samples\n\n### Getting started with Spanner in Ruby\n\n\nFirst steps using Spanner with Ruby\n\n\n[Get started](/spanner/docs/getting-started/ruby) \nCode sample \nCode Samples\n\n### Getting started with Spanner in C++\n\n\nFirst steps using Spanner with C++\n\n\n[Get started](/spanner/docs/getting-started/cpp)\n\nRelated videos\n--------------"]]