Design, migrate, and run scalable, highly available databases on Google Cloud across relational and NoSQL services, and track your readiness for the Professional Cloud Database Engineer exam.
Prepare and test your skills
Prepare and test your skills
Differentiating managed and unmanaged database services means deciding who owns patching, backups, replication, and failover. Self-managed databases leave that work to the operator, while Google-managed services automate it behind a service API.
Shared responsibility on Compute Engine (opens in a new tab) divides database work between Google and the operator. Google manages data centers, hosts, power, and the physical network, while the operator installs MySQL, PostgreSQL, or SQL Server on a virtual machine (VM) and owns the operating system, database software, patching, monitoring, availability design, and recovery. Database Center health checks show where manual work remains, including outdated minor versions, broad network exposure, unencrypted connections, disabled auditing, and missing root passwords for MySQL and PostgreSQL. For durability the operator chooses Backup and DR Service, Persistent Disk snapshots that are incremental with checksums and restorable across zones and regions, and regional Cloud Storage buckets that replicate data across zones.
Operator recovery often rebuilds a failed database VM without a synchronized standby. In that pattern Compute Engine runs the database server and disks, managed instance groups (MIGs) detect failure and recreate the VM, and internal Cloud Load Balancing (opens in a new tab) preserves a stable endpoint. The build order is fixed because each step depends on the previous image and template:
Data flows from the latest snapshot to a new disk, the disk attaches to the new VM, and client traffic flows from the internal load balancer to the replacement. Standard persistent disks are zonal and require snapshot restore after zonal failure, while regional persistent disks replicate synchronously between two zones in the same region.
Infrastructure control with Bare Metal Solution means keeping hardware-level control for licensed workloads instead of using fully abstracted cloud databases. Google Cloud configures and provides SAP-certified bare-metal servers in regional extensions co-located with Google Cloud and connected through a managed, high-performance connection with a low-latency fabric. After delivery the customer owns licensing, installation, and maintenance of SAP NetWeaver, SAP applications, and database software such as Oracle. Certified servers are available only in Bare Metal Solution regional extensions, listed in SAP Note 3000343, and for new SAP NetWeaver deployments Google Cloud recommends Compute Engine C3 or C4 machine types instead.
Latency architecture decides where application servers run relative to the database. Traffic flows from application servers to the database over the Partner Interconnect connection or over the local fabric inside the same regional extension, while replication traffic between primary and disaster recovery (DR) sites passes through the Google Cloud network.
| Architecture | Where application servers run | Choose when |
|---|---|---|
| Hybrid architecture | Application servers run on Google Cloud, database runs in Bare Metal Solution | Flexibility and lower cost are priorities |
| All-metal architecture | Application servers and database run in the same regional extension | Workload needs latency below Partner Interconnect levels or requires the same platform |
Scaling and availability tradeoffs compare manual operator work with native automation. A self-managed primary copies data to a standby through administrator-configured replication, identical server configuration, and manual promotion and DNS redirection during failure. Managed services replicate, scale, and fail over automatically, so traditional backup and restore tools from relational systems are often unavailable.
Spanner (opens in a new tab) shows abstracted performance without hardware management. Spanner is a fully managed database that performs zero-downtime updates, presents a single-machine API, scales with a managed autoscaler from 1/10th of a node to tens of thousands of nodes, and supports hundreds of millions of requests per second and petabytes of data with consistent low latency. Clients use gRPC/HTTP2 that handles connection failures, language-native NoSQL APIs without SQL knowledge, flexible JSON and BYTES types, and Identity and Access Management (IAM)-based access without stored passwords. The operational choice is therefore control versus automation:
| Model | Backups and durability | Availability and failover |
|---|---|---|
| Self-managed on Compute Engine | Operator schedules snapshots, Backup and DR Service jobs, and log copies; RPO depends on frequency | Operator builds MIGs, health checks, internal load balancing, and observer-based failover |
| Google-managed service | Google takes backups per retention policy; Bigtable manages table backups and cross-cluster copies | Google replicates data and fails over automatically; operator selects regional or multi-region topology |
Exam tip: Cloud SQL in high availability (HA) configuration fails over automatically with no endpoint IP change, while a self-managed database on Compute Engine requires the operator to build failover with an internal load balancer and failure detection.
Distinguishing SQL and NoSQL business requirements means matching data shape, consistency needs, and growth plans to the least structure needed for correctness. Relational and non-relational stores are complementary, so one application can use both.
Data shape and schema flexibility decide whether a rigid relational schema or a flexible NoSQL model fits. Structured data has a stable shape with consistent fields and relationships, while semi-structured and unstructured data varies in shape or has no fixed fields. AlloyDB for PostgreSQL (opens in a new tab) enforces rigid schema-on-write for structured transactional records, which supports correctness through transactions, strong consistency, referential integrity, and joins across tables. Flexible stores such as Firestore in Native mode and with MongoDB compatibility, Datastore, Bigtable, and Memorystore avoid requiring all schema upfront and suit variable documents, wide-column key-value data at terabyte to petabyte scale, and in-memory access. Non-relational systems typically sacrifice some relational features for availability and easier scalability, and under the CAP theorem they often choose availability over consistency.
| Engine | Best-fit data shape | Schema and consistency approach |
|---|---|---|
| AlloyDB for PostgreSQL | Structured records with stable relationships | Rigid schema-on-write with transactions and joins |
| Firestore and Datastore | Variable documents for web and mobile | Flexible document schema with automatic scaling |
| Bigtable | Massive operational and analytical key-value data | Flexible wide-column schema for large scale |
| Spanner | Growing workloads needing correctness plus flexible values | Relational schema plus JSON and BYTES with ACID transactions |
Vector embeddings and similarity search support meaning-based retrieval instead of exact lookup. A vector embedding is a long list of numbers created by a generative model to represent text, images, or video, where similar meanings sit close together. A query converts search input into an embedding and returns nearest neighbors by distance measures such as COSINE, L2_SQUARED, and DOT_PRODUCT, which powers recommendations, semantic text and image search, natural language search, anomaly detection, and retrieval-augmented generation (RAG).
BigQuery generates embeddings with SQL and stores them beside analytical data. The AI.EMBED function generates one embedding for text or ObjectRef image data, AI.GENERATE_EMBEDDING creates a table of embeddings for a column, and autonomous embedding generation maintains the column automatically when source data changes. Cloud SQL for MySQL stores vectors in VECTOR columns with a fixed dimension count under the same ACID and InnoDB replication behavior as other columns. Search divides into exact K-nearest neighbors (KNN) with vector_distance that scans all data, and approximate nearest neighbors (ANN) with approx_distance that checks only part of the data for faster but approximate results. Vector indexes organize embeddings into partitions so ANN checks only nearby clusters, trading recall accuracy for speed.
Exam tip: Use VECTOR_SEARCH when performance is critical over many precomputed embeddings, and use AI.SIMILARITY only for a small number of ad hoc comparisons without precomputed embeddings.
Transactional integrity versus scalability is the choice between guaranteed correctness and global growth with high availability. Relational engines keep multi-step updates atomic, return the latest committed write to every reader, and enforce relationships, which fits ledgers and inventory where stale reads cause errors. NoSQL systems scale horizontally by allowing eventual consistency, where replicas stay available for reads even before they receive the latest write. Eventual consistency guarantees that all reads eventually return the last value if no new updates occur, as in Domain Name System (DNS) caching, but bidirectional replication can cause write-write conflicts that need resolution rules or manual repair.
Distribution models preserve or relax integrity in opposite ways. A fully synchronized active-active system commits updates transactionally in all primary locations so every application sees the last consistent state without lag. Sharding divides data into disjointed partitions with one instance per partition and adds shards dynamically for throughput and storage growth, but cross-shard queries may not be possible. Spanner bridges the models with strongly consistent, globally distributed SQL.
Analyzing database cost on Google Cloud means comparing billing models, storage and network charges, and managed versus self-managed labor. Total Cost of Ownership (TCO) includes hardware, licenses, power, cooling, support, network use, and engineering time, not just instance size.
Billing models and commitment discounts control how consumption converts to charges. On-demand pricing bills actual use with no commitment and fits testing and spiky demand, while committed use discounts (CUDs) (opens in a new tab) lower rates for one-year or three-year commitments and can stack on enterprise discounts with auto-renewal. The central FinOps team typically manages commitments across the organization while product teams manage sizing.
| Discount type | What is committed | Scope where discount applies |
|---|---|---|
| Enterprise discounts | Minimum total spend at negotiated rate | Organization commitment on overall spend |
| Resource-based CUDs | Minimum quantity of Compute Engine resources for one or three years | Specific region, sharable across projects in most billing accounts |
| Spend-based CUDs | Minimum spend on a product for one or three years | Billing account level, regional or global by product |
Serverless consumption scales cost with traffic, such as Cloud Run adding instances as traffic rises and removing them as it falls. Flexible options include Spot VMs at more than 80% lower cost than regular VMs for fault-tolerant batch work that tolerates preemption, sustained use discounts after continuous-use thresholds, and product-specific reservations such as BigQuery slots.
Storage, networking, and lifecycle costs determine long-term spend for data at rest and in motion. Storage location sets unit price and replication charges, since dual- and multi-region buckets cost more than single-region buckets plus inter-region replication. Compute Engine prices also differ by region, so the same database can cost more or less by placement. Google Cloud charges for traffic between regions as egress, while on-premises networking is a one-time purchase, so closely related compute and storage should sit in the same region.
Data lifecycle management controls growth by deleting unneeded data, keeping smaller aggregates long term, and moving infrequent data to cheaper tiers. Cloud Storage Object Lifecycle Management automates deletion or class changes, while Autoclass transitions each object to the right class by access pattern. Tiered backup storage moves aging data from Nearline for infrequent access to Coldline for rare access to Archive for very rare access at the lowest storage cost with added retrieval costs.
Exam tip: Avoid inter-region egress by co-locating compute with the data it uses, and choose a multi-region bucket only when automatic replication across regions is required for reliability.
Managed versus self-managed total cost compares included operations with separate licenses and labor. Cloud SQL is a fully managed service for MySQL, PostgreSQL, and SQL Server that handles backups, export and import, high availability and replication, encryption and connectivity, storage management, maintenance, monitoring, and logging. Each instance runs a VM with service agents, database files on scalable persistent disk, and a static IP in front, with an identical standby VM in another zone when HA is enabled. SQL Server on Compute Engine gives full VM control but leaves patching, scaling, hardening, and recovery to the team and requires separate third-party license accounting, while Cloud SQL includes the license in its price based on CPUs, memory, GiB storage, region, egress, and IP use.
| Option | What you pay for | Who owns operations |
|---|---|---|
| Cloud SQL | CPUs, memory, provisioned storage, region, egress, IP use with license included | Google owns hardware, agent updates, OS and database maintenance, backups, and failover |
| Compute Engine self-managed | VM, disks, network, plus separate database licenses | Team owns patching, upgrades, availability, backups, hardening, and monitoring |
Assessing application and database dependencies means checking network placement, connection behavior, and security controls together. Distance adds latency and egress cost, connection growth can overload the database, and identity boundaries decide what data can move.
Network topology and request flow describe where tiers sit and how traffic moves inward. Virtual Private Cloud (VPC) (opens in a new tab) is the global networking system that connects resources, with a baseline design placing load balancers, Compute Engine VMs, and database VMs in one VPC network and one subnet in one zone for the shortest path. A multi-region design keeps one VPC but adds per-region subnets for web VMs, application VMs, and proxy-only subnets for cross-region internal load balancing, or connects separate per-region VPCs with Network Connectivity Center. Private-only VMs reach Google APIs through Private Service Connect or Private Google Access, and outbound traffic flows through Cloud NAT or Secure Web Proxy.
The ordered request path names each hop from edge to data:
Single-zone designs have the lowest component latency and no intra-zone traffic cost, single-region multi-zone designs add intra-region cost but survive zone loss, and multi-region designs add the most replication and balancing cost but lower user latency globally and survive regional problems.
Connection pooling and data access choices decide how application scale affects the database. A connection pool is an application-side set of pre-created connections that requests reuse to reduce latency. Each service instance creates its own pool with a minimum connection count, so traffic flows from each instance through its own pool to the shared database and the database total equals the sum across instances. Uncontrolled scale-out therefore overloads the database because databases cannot support unlimited connections.
Database selection compares provider-managed systems such as Spanner, partner-managed systems, and self-managed systems on Compute Engine. A multi-regional managed database serves applications in multiple regions in one cloud, while a portable system such as AlloyDB Omni or PostgreSQL serves applications that must move across clouds. Using the best database in each cloud optimizes each location but requires significant one-directional or bidirectional replication effort, while using one portable system is easier to implement, operate, and maintain. When built-in replication is missing, data flows through external Striim replication or the MariaDB Galera Cluster add-on. Multi-model access with one engine for document, graph, key-value, column-family, and relational work under one interface reduces synchronization, as with Spanner supporting relational work, Spanner Graph, and vector search together.
Identity, perimeter, and encryption dependencies prove who the application is and keep data inside trusted boundaries. A service account is a non-human identity with a unique email that the application uses instead of shared human credentials, and IAM binds that identity to a role on a resource with inheritance from parent to child. Least privilege means separate accounts per task, only needed permissions, hardened authentication, and reduced use of downloadable keys. Cloud SQL IAM database authentication centralizes logins by enabling IAM authentication on the instance, adding IAM users as database users, and logging in with IAM credentials so authentication flows from application identity through IAM to the database.
VPC Service Controls creates a service perimeter where data flows only between resources inside, and requests from outside are denied even when IAM authorizes the caller. For Cloud SQL the perimeter can restrict import and export through the Cloud SQL Admin API or Cloud Storage API. Encryption protects content at rest and in transit by default, with customer-managed encryption keys (CMEK) in Cloud KMS, Cloud HSM inside hardware modules, or Cloud EKM outside Google infrastructure for regulated data. Identity-Aware Proxy (IAP) verifies identity before HTTPS or TCP access, and Cloud Next Generation Firewall (NGFW) controls traffic inside the architecture.
Exam tip: VPC Service Controls can block data movement outside a perimeter even if the user is authorized by IAM policy.
Continue with this study guide: Assess application and database dependencies
Identifying regulatory solutions means proving who accessed data, who holds encryption keys, and where data stayed. Cloud Audit Logs covers customer activity, Access Transparency covers Google personnel, and placement plus key controls enforce residency.
Auditing and data privacy controls move evidence from services to retained, monitored storage. Cloud Audit Logs (opens in a new tab) in Cloud Logging answers who did what, where, and when, with activity flowing from services to Cloud Logging and then to a log sink for retention. Comprehensive coverage includes Admin Activity logs for control-plane changes, Data Access logs for reads and writes, Cloud Identity logs shared from Workspace for logins, and VPC Flow Logs, firewall, DNS, and bucket logs for surrounding activity. Access Transparency sits on the provider side of the trust boundary and records Google support or engineering access, so retaining both sides proves oversight for GDPR and HIPAA.
Database-level auditing for Cloud SQL for PostgreSQL captures what platform logs miss through flags for connections, disconnections, duration, statements, minimum error statements, lock waits, checkpoints, and temporary files, while disabling noisy planner and parser statistics. Evidence lifecycle runs in order from generation with logging policies, to allocation and export to a sink, to retention with Bucket Lock against early deletion, to restricted access so each log read is itself accountable. Monitoring uses metric filters and alerts for project ownership changes, audit configuration changes, custom role changes, and firewall changes, while Sensitive Data Protection discovers and redacts identifiers to support minimization.
Encryption and key management decide who controls the keys that protect data at rest. Default Google-managed encryption creates, stores, and rotates keys automatically, while customer-managed keys in Cloud Key Management Service (Cloud KMS) (opens in a new tab) let the customer own lifecycle and revocation. A key ring groups crypto keys in a location, each key has versions that perform encryption, and the database calls Cloud KMS to encrypt and decrypt. The key location must match the database location, such as us-west1 for a regional database or us for Datastore mode nam5, with external keys supplied through Cloud External Key Manager (EKM).
A CMEK database can only be created with its key at creation time; an existing Google-managed database cannot be converted later. Creation flows from service identity to key material to permission to database: create the Firestore service agent or Oracle Principal ID, create the key ring and key in the same location, grant roles/cloudkms.cryptoKeyEncrypterDecrypter plus viewer roles where required, then supply the full key name in cmekConfig.kmsKeyName. Database details then shows Customer-managed versus Google-managed. Organization constraints constraints/gcp.restrictNonCmekServices and constraints/gcp.restrictCmekCryptoKeyProjects enforce CMEK use and centralize key projects. If permission is removed or the key is disabled or destroyed, decrypt calls fail and data requests fail until access is restored, typically within minutes up to three hours.
Exam tip: An existing Google-managed database cannot be converted to CMEK; CMEK must be selected at creation and the key cannot be added or changed later.
Data residency and sovereignty keep database data inside required legal jurisdictions through placement plus organizational and network controls. A region holds zones with redundant power and connectivity, and placement affects latency, CPU availability, and compliance, so application servers and databases should share a region. For FedRAMP High and Department of Defense (DoD) Impact Level 2, 4, and 5, subnets must exist only in US regions, regional load balancers must replace global balancers to keep termination inside the boundary, and Assured Workloads provides the compliance framework.
Resource scope controls whether dependencies leak outside: global resources such as disk images and snapshots are accessible across regions, regional resources such as static external IPs stay in one region, and zonal resources such as Compute Engine instances and disks stay in one zone. Private connectivity keeps traffic regional through Private Service Connect to managed and third-party producer services, Private Google Access for internal-only VMs to reach Google APIs, and private service access for producer VPCs. Cloud NAT provides outbound access without public exposure, while Google Cloud Armor protects regional balancers against distributed denial-of-service (DDoS) and cross-site scripting (XSS).
Continue with this study guide: Identify solutions to support regulatory and compliance requirements
Understanding organizational policy implications means translating recovery mandates, quotas, regulations, and security guardrails into database choices. Recovery time objective (RTO) is maximum allowed downtime, while recovery point objective (RPO) is maximum allowed data loss.
Recovery objectives and resource limits set how fast the database must return and how much data it may lose. Tier 1 applications such as real-time payments often require zero RTO and zero RPO for zone and region outages, Tier 2 such as CRM may allow 15 minutes in a zone and one hour in a region, and Tier 3 departmental systems may allow one hour in a zone and 12 hours in a region. Smaller windows cost more because they need more replication, standby capacity, and frequent backups. Critical recovery must depend only on the data plane that serves reads and writes during an outage, not on management-plane APIs or IAM updates that may be unavailable.
High availability (HA) handles zone outages in one region with synchronous replication and automatic failover for zero or near-zero RTO and RPO, while disaster recovery (DR) handles region outages with typically asynchronous replication and manual or semi-automated failover with higher RTO and RPO. Aggregate availability multiplies chained tiers, so four tiers at 99.9% yield about 99.6%, while parallel services follow 1 minus the joint failure rate, so two 99% services in parallel yield 99.99%. Backup frequency sets the loss window and retention sets how far back restore can go, with point-in-time recovery (PITR) up to 7 days in the past. A hot standby gives the lowest RTO at the highest cost, while stopped VMs or template-built VMs lower cost with longer recovery. Quotas further constrain failover because most Compute Engine quotas are regional, so the recovery region must already have quota for VMs, disks, and machine types.
Exam tip: HA supports zero or near-zero RTO and RPO with synchronous replication inside one region, while DR across regions typically uses asynchronous replication and requires planned failover with higher RTO and RPO.
Regulatory and residency rules dictate where data can live and who can access it. The customer places data in compliant regions and configures services correctly, while Google provides inherited encryption and infrastructure controls. Payment Card Industry Data Security Standard (PCI DSS) uses a shared responsibility matrix for card data, Health Insurance Portability and Accountability Act (HIPAA) governs electronic personal health information (PHI), General Data Protection Regulation (GDPR) requires EU personal data to stay in EU regions including replicas and backups, and FedRAMP High requires workloads inside the Data Boundary for FedRAMP High under control SA-9(5).
Data residency (opens in a new tab) therefore depends on region selection for the project containing the database, with data flows from application to database never leaving approved regions through replication, export, or tooling. Google Cloud holds a FedRAMP High provisional authorization covering more than 150 services with a Customer Responsibility Matrix, System Security Plan, and implementation guides, and FedRAMP Moderate can use any High-authorized service with fewer controls. Assured Workloads with the Data Boundary enforces the High perimeter, and non-production copies must follow the same VPC strategy to avoid leakage.
Identity, encryption, and perimeter governance enforce least privilege, key control, and service boundaries. Organization policies Restrict Resource Service Usage and Resource Location Restriction decide which database services can be chosen and in which regions data may reside, so a disallowed service or region blocks creation. IAM verifies identity through authentication then grants only needed roles at organization, folder, or project scope, with project grants applying to all instances in that project. Functional groups for administrators, developers, and auditors replace individual grants, with single sign-on, 2-step verification, role recommendations, and disabled service-account key creation and upload.
Default encryption uses Google-owned keys, while CMEK stores customer-managed software or hardware keys in Cloud KMS, optionally provisioned by Autokey, when compliance requires control of rotation and disabling. The database depends on Cloud KMS to unwrap keys on each access, so disabling the key stops access. VPC Service Controls defines a trusted perimeter around projects, blocks access to services outside, and uses access levels only for approved outside-to-inside requests without letting inside resources send data out.
Spanning multiple database technologies means moving, replicating, or querying data across engines and clouds without fragile copies. The same migration process supports one-time exports, continuous sync, and hybrid operation.
Data movement and migration consistency define sources, targets, and in-transit logic so the target ends equivalent to the source. Data flows from each source to the migration system for extraction, then to each target for insertion with optional transformation, with independent databases moving in parallel. Log-based change data capture (CDC) such as MySQL binary-log reading preserves order with the least source load, while differential querying polls timestamp or sequence fields, adds query load, needs schema changes, and handles deletes with flags or separate tables. A consistent migration is complete with all specified data moved, duplicate free with each item moved once, and ordered with source order preserved.
Cardinality lets a move redesign architecture: direct 1:1 mapping copies one source to one target, consolidation with n:1 merges several sources into fewer targets, distribution with 1:n splits one source into several targets such as regional databases, and re-distribution with n:m rebalances shards. Write models set conflict risk: active-passive with writes only to sources risks ordering and completeness, while active-active with writes to both sides risks write-write conflicts needing resolution. Deployment patterns trade lag for consistency from partitioned databases with no sharing, to asynchronous unidirectional replication where the primary feeds an analytical secondary with lag, to bidirectional replication with conflict resolution, to fully synchronized active-active where every commit is immediately visible everywhere.
Exam tip: Choose log-based CDC over differential querying when both are available, because CDC preserves order without loss and avoids extra schema fields and polling load.
Hybrid and multi-cloud architectures distribute processing across environments with private networking and governed access. The tiered hybrid pattern runs a stateless, frequently updated frontend in Google Cloud while the data-heavy backend stays on-premises, with client requests flowing to the frontend and then back to the backend ideally through an API gateway. Containerizing tiers supports phased moves to Cloud Run or Google Kubernetes Engine (GKE), with Cloud SQL as a managed backend example. Secure connectivity uses VPC for isolation, Cloud Router with Border Gateway Protocol (BGP) for dynamic routes over Interconnect and VPN, Cloud NAT for secure outbound access, and Cross-Cloud Interconnect for private Google Cloud to Amazon Web Services (AWS) database access that avoids public-internet egress fees and latency. Secret Manager stores service principal credentials and DNS policies route to passive replicas in other regions.
Residency follows location controls: regional Cloud Storage buckets replicate synchronously across zones, dual-region and multi-region buckets replicate asynchronously across regions, Pub/Sub message storage policies pin messages to locations, and Filestore Regional instances replicate synchronously across three zones with optional cross-region copies. Multi-cloud federation avoids movement by querying data where it lives through the open Apache Iceberg format with Parquet files in Cloud Storage and Amazon Simple Storage Service (Amazon S3). BigQuery AlloyDB federation sends queries from BigQuery to live AlloyDB data without change-data-capture pipelines, while Borderless Lakehouse governs metadata by connecting to Databricks Unity Catalog, verifying credentials in Secret Manager, and opening lakehouse metadata only on approval.
Federation and external tables let BigQuery (opens in a new tab) analyze data without migrating it first. Federated queries send a statement from BigQuery to AlloyDB, Spanner, or Cloud SQL through a BigQuery Connection API connection and return a temporary table, using EXTERNAL_QUERY in the source dialect with type conversion for joins. Setup runs in order from locating the source project, to creating the connection as bigquery.admin, to sharing the connection, to running EXTERNAL_QUERY. External tables instead store metadata in BigQuery while data stays outside and use standard BigQuery syntax without EXTERNAL_QUERY.
| Method | How you query | Security model | Representative sources |
|---|---|---|---|
| Federated queries | EXTERNAL_QUERY in source dialect returns temporary table | Connection plus database user account | Spanner, Cloud SQL, AlloyDB |
| BigLake tables | BigQuery syntax against table reference | Access delegation through service account | Cloud Storage, S3 and Azure via Omni |
| External tables | BigQuery syntax against table reference | Permissions on both table and source | Cloud Storage, Bigtable, Drive |
| Object tables | BigQuery syntax over file metadata | Access delegation through service account | Unstructured Cloud Storage data |
AlloyDB for PostgreSQL (opens in a new tab) and Cloud SQL federation is fastest when BigQuery processing is close to the source, and a single region can only query AlloyDB or Cloud SQL in the same region while US or EU multi-regions can query single-region sources in the same area except southamerica-east1 from US. Limits include 1 TB per project per day for cross-region federated queries, at most 10 unique connections per query, and no maximum-bytes-billed estimate. BigQuery Omni runs analytics on S3 or Azure Blob Storage with local compute through BigLake tables, using joins for one-time analysis, materialized views for repeated dashboards, SELECT transfer for complex one-time moves, and LOAD for raw migration.
Leveraging databases for generative AI means storing embeddings beside business data, serving similarity search at scale, and grounding large language model (LLM) answers in retrieved facts. Retrieval-Augmented Generation (RAG) retrieves real-time context before generation to reduce hallucinations.
Retrieval-Augmented Generation architecture connects a vector store to Vertex AI embedding and generation models. A grounding path supplies prompt context, either as embeddings optimized for similarity search or as standard query results from Cloud SQL or Firestore, with Gemini optionally using Google Search grounding for internet facts.
| Option | Best for | How it relates to data |
|---|---|---|
| Vertex AI Search | Fully managed search without exposing vectors | Indexes sources and serves grounded results |
| Vertex AI RAG Engine | Managed orchestration with LlamaIndex-like interface | Retrieves from vector stores including Feature Store |
| Vertex AI Vector Search | Low-latency large-scale serving | Dedicated index for approximate nearest-neighbor search |
| Cloud SQL with Vertex AI | Operational data already in SQL | Calls models from SQL with low latency |
Cloud SQL (opens in a new tab) integration runs predictions and embeddings inside transactions on Cloud SQL for PostgreSQL version 12 and later, Cloud SQL for MySQL version 8.0.36 and later, and Cloud SQL for SQL Server 2025 Enterprise and Enterprise Plus in Preview with Vertex AI, Hugging Face, and OpenAI endpoints. Ingestion flows from a Cloud Run function that chunks new data, to an embedding model on Gemini Enterprise Agent Platform, to AlloyDB for PostgreSQL (opens in a new tab) with the pgvector extension for later semantic retrieval. The serving flow runs in order from user request through a frontend, to query embedding with the same model and parameters as ingestion, to semantic retrieval in AlloyDB combined into a contextualized prompt, to LLM generation on Agent Platform, to logging in Cloud Logging and BigQuery, to responsible AI filtering before delivery.
Vector storage and index choices balance latency, memory, recall, and build time in one operational database. AlloyDB AI stores embeddings in a vector column beside business rows so one query combines similarity with SQL filtering, keyword search, and reranking. The customized vector extension supports IVF with scalar quantization plus stock IVFFlat and Hierarchical Navigable Small World (HNSW) indexes, while the alloydb_scann extension implements Scalable Nearest Neighbors (ScaNN) for PostgreSQL 14 through 17 and can load into the columnar engine through google_columnar_engine.
| Index | Best fit | Documented performance |
|---|---|---|
| ScaNN | Large-scale and filtered search where build time and memory matter | Up to 10x faster creation, 4x faster queries, 10x faster filtered search than HNSW, 3x less memory |
| HNSW | Higher-dimensional data fitting largely in memory, 10-20 million vectors | Columnar-accelerated HNSW up to 4x faster than standard HNSW |
Tuning trades queries per second against recall, or how often true neighbors return. Data flows from the embedding model into the vector column, then the index organizes vectors before fast ranking. Google recommends creating an index for similarity queries, using the columnar engine for filtered k-nearest-neighbor search, and using Auto mode to maintain ScaNN indexes as data grows.
Exam tip: Choose ScaNN when you need lower memory and faster builds and filtered queries than HNSW; ScaNN uses 3x less memory and runs queries up to 4x faster than HNSW.
Scaling and securing AI-integrated workloads keeps retrieval fast without exposing embeddings or source data. AlloyDB clusters provide high availability by default with active and standby nodes in two zones and automatic failover, while basic primary instances cost less but lack zone robustness. Vertex AI Vector Search index endpoints autoscale nodes with queries per second up to a specified maximum, AlloyDB committed use discounts lower predictable CPU and memory cost, batching high-throughput Vector Search requests reduces node use, and Pub/Sub flow control absorbs spikes before they reach the database. Quality evaluation runs from Pub/Sub triggering a Cloud Run function that loads configuration and prompts from AlloyDB, scores factual accuracy and relevance, and loads scores to BigQuery for analysis.
Governance applies least-privilege IAM with conditions, principal access boundaries, and just-in-time elevation, plus row-level and column-level security in BigQuery and IAM over access control lists (ACLs) in Cloud Storage. AlloyDB accepts only SSL connections by default and adds IAM-based authorization through the Auth Proxy with Transport Layer Security (TLS) 1.3 and 256-bit Advanced Encryption Standard (AES). VPC Service Controls perimeters with ingress and egress rules prevent exfiltration, private IPs and Private Service Connect avoid public exposure, and default encryption with optional CMEK plus Sensitive Data Protection and regional residency controls protect stored embeddings.
Last updated