Re: How to do faster DML - Mailing list pgsql-general

From Marcos Pegoraro
Subject Re: How to do faster DML
Date
Msg-id CAB-JLwbTSaQX49BqOttyLwzFOzgq2Ymk0+CBVNYhRQoQUivROA@mail.gmail.com
Whole thread Raw
In response to Re: How to do faster DML  (Greg Sabino Mullane <htamfids@gmail.com>)
Responses Re: How to do faster DML
List pgsql-general
insert into mytable2 select * from mytable1 order by ctid limit 10_000_000 offset 20_000_000;

You can use min/max values grouping them by 10_000_000 records, so you don´t need that offset, then generate commands and run them.

select format('insert into mytable2 select * from mytable1 where i between %s and %s;', max(i), min(i)) from t group by i/10_000_000;

pgsql-general by date:

Previous
From: Francisco Olarte
Date:
Subject: Re: How to do faster DML
Next
From: Dennis White
Date:
Subject: Re: How to do faster DML