Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

226
Views
How to COPY into one PostgreSQL table in parallel without lock?

As I see in pg_stat_activiry, only one of COPY command executes at once. Other queries are in Lock state as I see in wait_event_type column.

There are only one active query at once

How can I run several COPY mytable FROM STDIN in parallel without locking table?

ps. mytable is hypertable of TimescaleDB 2.5.0.

UPD

CREATE TABLE "public"."mytable" (
    "q_time" timestamp,
    "symbol_id" int,
    "o" decimal(24,12),
    "c" decimal(24,12),
    "h" decimal(24,12),
    "l" decimal(24,12),
    "v" bigint,
    CONSTRAINT mytable_ts_pkey PRIMARY KEY (symbol_id, "q_time")
);

SELECT create_hypertable('mytable', 'q_time', 'symbol_id', 1,
  create_default_indexes => false, 
  chunk_time_interval => '7 days'::interval);

UPD2

I run in parallel next commands:

out, err := exec.Command("bash", "-c", "cat file01.gz | gunzip | psql -d db -U user -c "\copy mytable from stdin HEADER DELIMITER ';' CSV\"").Output()

TimescaleDB 2.5.0

PostgreSQL 13

max_connections = 200

max_worker_processes = 21

max_parallel_workers = 10

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!