Re: problems maintaining boolean columns in a large table - Mailing list pgsql-general

From Filip Rembiałkowski
Subject Re: problems maintaining boolean columns in a large table
Date
Msg-id 92869e661002110620l2683933bk43843ff8aa8a5cd3@mail.gmail.com
Whole thread Raw
In response to Re: problems maintaining boolean columns in a large table  (Ben Campbell <ben@scumways.com>)
List 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 by date:

Previous
From: Filip Rembiałkowski
Date:
Subject: Re: error migrating database from 8.4 to 8.3
Next
From: "Timo Klecker"
Date:
Subject: Re: problems maintaining boolean columns in a large table