I encountered a problem while copying data from one to another table.
My first table looks like this:
create table persons ( person_id bigint not null constraint "primary" primary key, data text not null );
and another table:
create table persons_list ( id bigint default nextval('public.persons_list_id_seq'::STRING::REGCLASS) not null constraint "primary" primary key, person_id bigint not null constraint idx_person_id unique );
I want to have a list of all person_id in the persons_list table along with the SEQUENCE column.
My persons table has more than 10 million records and if I run something like:
INSERT INTO persons_list (person_id) SELECT person_id FROM persons
then the node will crash or the operation will be very long if the rows count is not so big. I assume that is due to that, first of all, all rows from persons will be saved in memory, and only after that INSERT will happen.
Is there are any solution to effectively copy from one table to another?
Thanks in advance.