D
D
Dannerty2018-11-02 14:23:57
PostgreSQL
Dannerty, 2018-11-02 14:23:57

Separate database dump, how to organize?

Hello. The problem arose when trying to set up separate storage of the combat base and statistics tables from it.
Tried several options.
1. Dumped, excluding data from statistics tables, and exported statistics to csv.
The problem arose when importing back. The process dragged on for a very long time, plus the memory on the disk was gobbled up several times more than when restoring from a full dump.
2. Did a dump, excluding data from tables, and uploaded statistics to sql files.
The problem was exactly the same as in option 1.
3. Did a dump, excluding the tables themselves, and uploaded the statistics to sql files.
The problem arose already at the stage of deploying the database itself without statistics, with crashes due to the inability to create views and dependencies.
Prompt, how it is possible to organize it, without re-creation of representations and dependences? Or will it all need to be recreated?
It is necessary to restore the database itself first without statistics, and then add it, so that if something happens, do not wait for the full dump to be deployed, but quickly roll back.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Melkij, 2018-11-02
@melkij

A logical dump will not be fast. Perhaps you need a physical backup, perhaps a lagging replica. See what you want to get.
Well, according to the logical dump - write data and build indexes or add indexes, and then write data - two very big differences.
Since we are talking about statistics - cut the statistics into partitions, you can shove them into a separate schema for convenience. Dump the main database accordingly with the exclusion of these partitions, then fill the sections with data and fasten them to the main plate. Or, better, dump the entire database into a more suitable format custom or directory, then restore the statistics sections separately with --exclude-schema.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question