To optimize the insertion of data into CockroachDB tables, there are a few tips:
- Create a table without any secondary indexes, insert your data and add any secondary indexes you want.
- Insert 500 lines into an
INSERT . This number may vary slightly depending on the size of your lines, but is a good guide for optimizing the speed at which you can write data.
If you are switching from PostgreSQL to CockroachDB, you can also use pg_dump to create a COPY statement that CockroachDB is optimized for swallowing. This is a slightly more complicated process, but you can find information on how to do this in the CockroachDB import documentation .
source share