I have an exporting need...

From: Juan Hernández <dejesusog(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: I have an exporting need...
Date: 2024-05-13 13:01:45
Message-ID: CAEPHxKcmsMFMcETu5D5brj_LYhZWVjANbNVGsXt2j=QRf+Lf_Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi team!

First, i want to thank you for having your hands in this. You are doing a
fantastic and blessing job. Bless to you all!

I have a special need i want to comment to you. This is not a bug, is a
need i have and i write here for been redirected where needed.

I have to make a daily backup. The database is growing a lot per day, and
sometimes i've had the need to recover just a table. And would be easier
move a 200M file with only the needed table instead of moving a 5G file
with all the tables i don't need, just a matter of speed.

I've created a script to export every table one by one, so in case i need
to import a table again, don't have the need to use the very big
exportation file, but the "tablename.sql" file created for every table.

My hosting provider truncated my script because is very large (more than
200 lines, each line to export one table), so i think the way i do this is
hurting the server performance.

Then my question.

Do you consider useful to add a parameter (for example, --separatetables)
so when used the exporting file process can create a different
tablename.sql file for each table in database automatically?

Example...

PGHOST="/tmp" PGPASSWORD="mydbpass" pg_dump -U dbusername --separatetables
-Fp --inserts dbname > "/route/dbname.sql"

And if this database has tables table1...table10, then 10 files are
created...

dbname_table1.sql
dbname_table2.sql
dbname_table3.sql
...
dbname_table8.sql
dbname_table9.sql
dbname_table10.sql

In each file, all main parameters will be generated again. For example the
file dbname_table1.sql...

--
-- PostgreSQL database dump
--
-- Dumped from database version 10.21
-- Dumped by pg_dump version 15.6
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
...
...
SET default_tablespace = '';
--
-- Name: table1; Type: TABLE; Schema: public; Owner: dbusername
--
CREATE TABLE public.table1 (
code numeric(5,0),
name character varying(20)
)

I dont know if many developers have same need as me. I hope this help in
future.

Thanks for reading me and thanks for what you've done.. You are doing fine!
Cheers!

______________
Juan de Jesús

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nazir Bilal Yavuz 2024-05-13 13:10:39 Re: Fix parallel vacuum buffer usage reporting
Previous Message Robert Haas 2024-05-13 13:00:28 Re: cataloguing NOT NULL constraints