Re: problems maintaining boolean columns in a large table

Поиск
Список
Период
Сортировка
От Filip Rembiałkowski
Тема Re: problems maintaining boolean columns in a large table
Дата
Msg-id 92869e661002110620l2683933bk43843ff8aa8a5cd3@mail.gmail.com
обсуждение исходный текст
Ответ на Re: problems maintaining boolean columns in a large table  (Ben Campbell <ben@scumways.com>)
Список pgsql-general


2010/2/10 Ben Campbell <ben@scumways.com>
I settled on:

CREATE TABLE needs_indexing (
 article_id integer REFERENCES article(id) PRIMARY KEY
);

The primary key-ness enforces uniqueness, and any time I want to add an article to the queue I just make sure I do a DELETE before the INSERT. Bound to be more efficient ways to do it, but it works.

better use

INSERT INTO needs_indexing (article_id)
SELECT NEW.id
WHERE NOT EXISTS ( SELECT 42 FROM needs_indexing WHERE article_id = NEW.id );





--
Filip Rembiałkowski
JID,mailto:filip.rembialkowski@gmail.com
http://filip.rembialkowski.net/

В списке pgsql-general по дате отправления:

Предыдущее
От: Filip Rembiałkowski
Дата:
Сообщение: Re: error migrating database from 8.4 to 8.3
Следующее
От: "Timo Klecker"
Дата:
Сообщение: Re: problems maintaining boolean columns in a large table