Skip to main content
Google Cloud
Documentation Technology areas
  • AI and ML
  • Application development
  • Application hosting
  • Compute
  • Data analytics and pipelines
  • Databases
  • Distributed, hybrid, and multicloud
  • Generative AI
  • Industry solutions
  • Networking
  • Observability and monitoring
  • Security
  • Storage
Cross-product tools
  • Access and resources management
  • Costs and usage management
  • Google Cloud SDK, languages, frameworks, and tools
  • Infrastructure as code
  • Migration
Related sites
  • Google Cloud Home
  • Free Trial and Free Tier
  • Architecture Center
  • Blog
  • Contact Sales
  • Google Cloud Developer Center
  • Google Developer Center
  • Google Cloud Marketplace
  • Google Cloud Marketplace Documentation
  • Google Cloud Skills Boost
  • Google Cloud Solution Center
  • Google Cloud Support
  • Google Cloud Tech Youtube Channel
/
  • English
  • Deutsch
  • Español
  • Español – América Latina
  • Français
  • Indonesia
  • Italiano
  • Português
  • Português – Brasil
  • 中文 – 简体
  • 中文 – 繁體
  • 日本語
  • 한국어
Console Sign in
  • Spanner
Guides Reference Samples Support Resources
Contact Us Start free
Google Cloud
  • Documentation
    • Guides
    • Reference
    • Samples
    • Support
    • Resources
  • Technology areas
    • More
  • Cross-product tools
    • More
  • Related sites
    • More
  • Console
  • Contact Us
  • Start free
  • Discover
  • Product overview
  • Spanner editions overview
  • PostgreSQL interface
  • Spanner for non-relational workloads
    • Non-relational overview
    • Cassandra interface
  • Get started
  • Spanner proof of concept playbook
  • Set up your environment
  • Create and query a database
    • Use the Google Cloud console
    • Use the gcloud CLI
  • Manage your data using the Google Cloud console
  • Client libraries
    • C++ quickstart
    • C# quickstart
    • Go quickstart
    • Java quickstart
    • Node.js quickstart
    • PHP quickstart
    • Python quickstart
    • Ruby quickstart
    • REST quickstart
  • Drivers
    • Set up with drivers
    • JDBC quickstart
    • Go database/sql quickstart
    • PostgreSQL drivers quickstart
  • Spanner CLI
  • Free trial instances
    • Free trial instances overview
    • Create a free trial instance
  • Data residency overview
  • Create and manage
  • Instances
    • Instances overview
    • Nodes and processing units
    • Regional, dual-region, and multi-region configurations
    • Region types
    • Replication
    • Geo-partition data
      • Geo-partitioning overview
      • Create and manage instance partitions
      • Create and manage data placements
    • Leader-aware routing
    • Global and regional service endpoints
    • Tiered storage
    • Create and manage instances
    • Create and manage instance configurations
    • Change dual-region quorum
    • Move an instance
    • Autoscale instances
      • Autoscaling overview
      • Managed autoscaler
      • Open source Autoscaler tool
        • Autoscaler tool overview
        • Deploy the Autoscaler tool to Cloud Run functions
        • Deploy the Autoscaler tool to GKE
    • Control access and organize instances using tags
  • Databases
    • Databases overview
    • Choose between GoogleSQL and PostgreSQL
    • Create and manage databases
    • Prevent accidental database deletion
    • Modify the leader region of a database
    • Set the default time zone for a database
  • Manage resources using Data Catalog
  • Design and manage a database schema
    • Schemas overview
    • Schema design best practices
    • Make schema updates
    • Create and manage named schemas
    • Views overview
    • Create and manage views
    • Secondary indexes
    • Foreign keys
    • Primary key default values management
    • Create and manage foreign key relationships
    • Create and manage check constraints
    • Create and manage generated columns
    • Store arbitrary precision numeric data
    • Create and manage sequences
    • Manage table names
    • Create and manage locality groups
  • Manage and observe long-running operations
  • Configure time to live (TTL)
    • TTL overview
    • Manage data retention with TTL
    • TTL metrics and monitoring
  • Connect
  • Connect to a PostgreSQL-dialect database
  • Connect PostgreSQL clients to Spanner using PGAdapter
    • PGAdapter overview
    • Get PGAdapter
    • Start PGAdapter
    • PGAdapter session management commands
    • Connect PGAdapter to the emulator
  • Connect to Spanner using the Cassandra Adapter
  • Create and connect a Compute Engine VM instance to access Spanner
  • Connect to Spanner with a GKE cluster
  • Connect to Spanner from other Google Cloud services
  • Authenticate to Spanner
  • Secure and control access
  • Access control with IAM
    • IAM overview
    • Apply IAM roles
  • Fine-grained access control
    • Fine-grained access control overview
    • Fine-grained access control for change streams
    • Fine-grained access control for sequences
    • Fine-grained access control for models
    • Configure fine-grained access control
    • Access a database with fine-grained access control
    • Fine-grained access control privileges
    • Fine-grained access control system roles
  • Add a custom organization policy
  • Data encryption
    • Customer-managed encryption keys (CMEK)
      • CMEK overview
      • Secure a database using CMEK
    • Data encryption in transit
  • Migrate
  • Migration process
    • Migration overview
    • Assess your migration
    • Migrate your schema
    • Migrate your application
    • Optimize your schema and application performance
    • Migrate your data
    • Validate your data
    • Configure cutover and fallback mechanisms
  • Migration tools
    • Migration tools overview
    • Set up Spanner migration tool (SMT)
  • Primary key migration
    • Primary key migration overview
    • Migrate primary keys
  • Migrate from MySQL
    • MySQL migration overview
    • MySQL schema migration
      • Migrate schema from MySQL overview
      • Use SMT to migrate schema from MySQL
    • Migrate your MySQL data
  • Load sample data
  • Migrate from DynamoDB
  • Migrate from Oracle
  • Migrate from PostgreSQL
    • Migrate to a GoogleSQL-dialect database
    • Migrate to a PostgreSQL-dialect database
  • Migrate from Cassandra
  • Migrate Spanner to a PostgreSQL database
  • Import and export data
  • Import and export overview
  • Import, export, and modify data using Dataflow
  • Import and export data in Avro format
    • Import Spanner Avro files
    • Export data from Spanner to Avro
    • Import data from non-Spanner databases
  • Import and export data in CSV format
  • Import data from PostgreSQL using COPY
  • Bulk loading best practices
  • Disaster recovery
  • Disaster recovery overview
  • Back up databases
    • Backups overview
    • Create backups
    • Create and manage backup schedules
    • Manage backups
  • Restore databases
    • Restore overview
    • Restore from a backup
  • Point-in-time recovery (PITR)
    • PITR overview
    • Recover data using PITR
  • Develop
  • Write SQL with Gemini assistance
  • Use case best practices
    • Spanner as a gaming database
  • Integrate language frameworks
    • Spanner with Hibernate
      • Integrate with Hibernate ORM (GoogleSQL)
      • Integrate with Hibernate ORM (PostgreSQL)
      • Write a Hibernate app that connects to Spanner
    • Spanner with Spring Data JPA
      • Integrate with Spring Data JPA (GoogleSQL)
      • Integrate with Spring Data JPA (PostgreSQL)
    • Spanner with Spring Data JDBC
      • Integrate with Spring Data JDBC (GoogleSQL)
      • Integrate with Spring Data JDBC (PostgreSQL)
    • Spanner with MyBatis
      • Integrate with MyBatis and Spring Boot (GoogleSQL)
      • Integrate with MyBatis and Spring Boot (PostgreSQL)
    • Spanner with Spring Data
    • Write a Spring Boot app that connects to Spanner
    • Spanner with GORM
      • Integrate with GORM (GoogleSQL)
      • Integrate with GORM (PostgreSQL)
    • Spanner with Django ORM
    • Spanner with SQLAlchemy
      • Integrate with SQLAlchemy (GoogleSQL)
      • Integrate with SQLAlchemy (PostgreSQL)
    • Spanner with Active Record
    • Spanner with Entity Framework Core
  • Use transactions
    • Transactions overview
    • Timestamp bounds
    • Commit timestamps
      • In GoogleSQL-dialect databases
      • In PostgreSQL-dialect databases
    • TrueTime and external consistency
    • Throughput optimized writes
    • Retrieve commit statistics for a transaction
    • Use SELECT FOR UPDATE
  • Sessions
  • SQL best practices
  • Read data
    • Reads outside of transactions
    • Directed reads
    • Read lease
    • Use Data Boost independent compute resources for reads
      • Data Boost overview
      • Run federated queries with Data Boost
      • Export data with Data Boost
      • Use Data Boost in your applications
      • Monitor Data Boost usage
      • Monitor and manage Data Boost quota usage
    • Use saved queries
      • Saved queries overview
      • Create and manage saved queries
  • Modify data
    • Modify data using the Google Cloud console
    • Modify data using the gcloud CLI
    • Modify data using DML
      • Insert, update, and delete data using DML
      • Partitioned DML
      • DML best practices
    • Modify data using mutations
    • Compare DML with mutations
    • Modify data using batch write
  • Work with data types
    • Work with arrays
      • In GoogleSQL-dialect databases
      • In PostgreSQL-dialect databases
    • Work with STRUCT objects
    • Work with NUMERIC data
    • Work with JSON data
    • Work with JSONB data
    • Work with protocol buffers in GoogleSQL
  • Develop and test
    • Emulate Spanner locally
    • Use Terraform with Spanner
    • Configure custom timeouts and retries
    • Configure statement timeout
    • Configure transaction timeout
  • Process and view data
    • Dataflow templates
    • Stream out data changes
      • Change streams overview
      • Create and manage change streams
      • Build change streams connections using Dataflow
      • Build change streams connections to Kafka
      • Change streams partitions, records, and queries
    • Integrate Spanner with IntelliJ
    • Integrate Spanner with Looker
    • Integrate Spanner with Liquibase
  • Full-text search
    • Full-text search overview
    • Tokenization and Search Indexes
      • Tokenization
      • Search indexes
      • Numeric search indexes
      • JSON search indexes
      • Partition search indexes
      • Combine TOKENLISTs
    • Full-text search queries
      • Query overview
      • Search multiple columns
      • Mix full-text and non-text queries
      • Rank search results
      • Perform a substring search
      • Find approximate matches with fuzzy search
      • Perform top-k pattern matching
      • Paginate search results
    • Search versus secondary indexes
  • Install MySQL functions in Spanner
  • Implement multi-tenancy in Spanner
  • Spanner AI and machine learning
  • Spanner AI overview
  • Get started using Spanner for generative AI applications
  • Spanner integration with Vertex AI
  • Vector search
    • Generate embeddings
      • Get Vertex AI text embeddings
      • Generate vector embeddings in bulk using partitioned DML
    • Perform K-nearest neighbors search
    • Choose the best vector distance function
    • Approximate nearest neighbors (ANN)
      • Perform ANN search with vector indexes
      • Create and manage vector indexes
      • Vector indexing best practices
    • Export embeddings to Vertex AI Vector Search
  • Generate predictions
    • Generate ML predictions using SQL
    • Use Generative AI with a sample ecommerce application
    • Generate ML predictions using the Spanner emulator
  • Integrate with AI technologies
    • Build LLM-powered applications using LangChain
    • Use Spanner with agents
    • Build applications using LlamaIndex
  • Spanner Graph
  • Product overview
  • Set up and query Spanner Graph
  • Spanner Graph schema
    • Schema overview
    • Manage a Spanner Graph schema
    • Best practices for designing a schema
  • Manage Spanner Graph data
  • Spanner Graph queries
    • Queries overview
    • Work with paths
    • Best practices for tuning queries
    • Use full-text search with Spanner Graph
    • Use vector search with Spanner Graph
  • Spanner Graph visualizations
    • Work with Spanner Graph visualizations
    • Spanner Graph visualization integrations
  • Manage schemaless data with Spanner Graph
  • Migrate to Spanner Graph
  • Spanner Graph reference for openCypher users
  • Troubleshoot Spanner Graph
  • Monitor
  • Capture telemetry signals
    • Signal capture overview
    • Trace collection
      • Trace collection overview
      • Set up trace collection using OpenTelemetry
    • Metrics
      • Metrics list
      • Client-side metric collection
        • View and manage client-side metrics
        • Client-side metrics description
      • Custom client-side metric collection
        • Capture custom client-side metrics using OpenTelemetry
        • Capture custom client-side metrics using OpenCensus
    • Audit logs
  • Monitor instances
    • Monitor instance performance using insights
    • Monitor instances using Cloud Monitoring
  • Optimize and troubleshoot
  • Optimize Spanner performance
    • Performance overview
    • Analyze query performance
    • Monitor active queries
    • Query optimizer
      • Query optimizer overview
      • Query optimizer versions
      • List query optimizer versions
      • Manage the query optimizer
    • Query execution plans
    • Tune a query using the query plan visualizer
    • Accelerate analytical queries using the columnar engine
      • Spanner columnar engine overview
      • Configure Spanner columnar engine
      • Query columnar data
      • Monitor columnar engine
    • Find hotspots in your database
    • Use the index advisor
  • Manage split points for anticipated traffic increase
    • Pre-splitting overview
    • Create and manage split points
  • Analyze usage patterns with Key Visualizer
    • Key Visualizer overview
    • Access Key Visualizer
    • Explore Key Visualizer heatmaps
    • Key Visualizer heatmap patterns
  • Troubleshoot latency
    • Latency points in a Spanner request
    • Identify where latency occurs
    • Use metrics to diagnose latency
    • Calculate streaming and partition request latency
    • Identify transactions that cause high latencies
  • Troubleshoot issues using built-in statistics tables
    • Built-in statistics tables overview
    • Query statistics
    • Oldest active queries statistics
    • Active partitioned DMLs statistics
    • Read statistics
    • Transaction statistics
    • Lock statistics
    • Columns operations statistics
    • Table sizes statistics
    • Table operations statistics
    • Split statistics
  • Troubleshoot instance utilization
    • CPU utilization overview
    • Troubleshoot high CPU utilization
    • Storage utilization
  • Troubleshoot performance regressions
  • Observe and troubleshoot with Gemini assistance
  • Troubleshoot CMEK org policy violations
  • Troubleshoot with request tags and transaction tags
  • Troubleshoot deadline exceeded errors
  • Troubleshoot Vertex AI integration errors
  • Error codes
  • AI and ML
  • Application development
  • Application hosting
  • Compute
  • Data analytics and pipelines
  • Databases
  • Distributed, hybrid, and multicloud
  • Generative AI
  • Industry solutions
  • Networking
  • Observability and monitoring
  • Security
  • Storage
  • Access and resources management
  • Costs and usage management
  • Google Cloud SDK, languages, frameworks, and tools
  • Infrastructure as code
  • Migration
  • Google Cloud Home
  • Free Trial and Free Tier
  • Architecture Center
  • Blog
  • Contact Sales
  • Google Cloud Developer Center
  • Google Developer Center
  • Google Cloud Marketplace
  • Google Cloud Marketplace Documentation
  • Google Cloud Skills Boost
  • Google Cloud Solution Center
  • Google Cloud Support
  • Google Cloud Tech Youtube Channel
  • Home
  • Documentation
  • Databases
  • Spanner
  • Guides

Import data by using PostgreSQL COPY
Stay organized with collections Save and categorize content based on your preferences.

You can use the PostgreSQL COPY FROM STDIN command to import data into a PostgreSQL-dialect database. For details, see COPY command for importing data in the psql command-line tool reference.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-09-19 UTC.

  • Why Google

    • Choosing Google Cloud
    • Trust and security
    • Modern Infrastructure Cloud
    • Multicloud
    • Global infrastructure
    • Customers and case studies
    • Analyst reports
    • Whitepapers
  • Products and pricing

    • See all products
    • See all solutions
    • Google Cloud for Startups
    • Google Cloud Marketplace
    • Google Cloud pricing
    • Contact sales
  • Support

    • Community forums
    • Support
    • Release Notes
    • System status
  • Resources

    • GitHub
    • Getting Started with Google Cloud
    • Google Cloud documentation
    • Code samples
    • Cloud Architecture Center
    • Training and Certification
    • Developer Center
  • Engage

    • Blog
    • Events
    • X (Twitter)
    • Google Cloud on YouTube
    • Google Cloud Tech on YouTube
    • Become a Partner
    • Google Cloud Affiliate Program
    • Press Corner
  • About Google
  • Privacy
  • Site terms
  • Google Cloud terms
  • Manage cookies
  • Our third decade of climate action: join us
  • Sign up for the Google Cloud newsletter Subscribe
  • English
  • Deutsch
  • Español
  • Español – América Latina
  • Français
  • Indonesia
  • Italiano
  • Português
  • Português – Brasil
  • 中文 – 简体
  • 中文 – 繁體
  • 日本語
  • 한국어