Re: Updating a very large table
| От | Kevin Grittner |
|---|---|
| Тема | Re: Updating a very large table |
| Дата | |
| Msg-id | 49F1D408.EE98.0025.0@wicourts.gov обсуждение |
| Ответ на | Re: Updating a very large table (Chris Browne <cbbrowne@acm.org>) |
| Ответы |
Re: Updating a very large table
|
| Список | pgsql-admin |
Chris Browne <cbbrowne@acm.org> wrote:
> I'd suggest adding an index
The OP said the table had 15 indexes already. I would guess one of
those could be used. Perhaps it has a primary key....
> update table1 set new_column = [whatever calculation]
> where new_column is null and
> quasi_unique_column in
> (select quasi_unique_column from table1
> where new_column is null limit 1000);
Or, if the primary key (or other unique or quasi-unique existing
index) has multiple columns, this could still be done with:
update table1 set new_column = [whatever calculation]
where new_column is null and
(col1, col2) in
(select col1, col2 from table1
where new_column is null limit 1000);
-Kevin
В списке pgsql-admin по дате отправления: