B
B
blohinn2018-08-15 21:14:23
PostgreSQL
blohinn, 2018-08-15 21:14:23

How to slice data from a database that is in production?

Suppose there is a database structure.
Hundreds of tables, keys, dozens of indexes, etc. It is important that the structure of the database in the development environment and in production is the same (we achieve this with migrations).
Data:
The production database has 100 GB of data. Too much to dump and give to the developer for development, but it is necessary to develop on real data (I know about libraries for generating fake data, this is not the question).
How to slice (or how to correctly call it) a small piece (say, 50 mb) of data for development, while maintaining all foreign keys and data integrity?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Ambrosian, 2018-08-15
@Ambrosian

  1. file system snapshots
  2. database replication

K
ky0, 2018-08-16
@ky0

You make a dump from two pieces: the main part without healthy tables + data sampling from healthy tables. You roll 1, then 2.
In general, partitioning is great for such purposes - when transferring, just don’t dump everything in a row, but only the set that suits you in terms of completeness / size.

V
Vyacheslav Uspensky, 2018-08-16
@Kwisatz

What's wrong with a 100 GB dump? There is just a chance that there will be no idiotic requests on the volume.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question