| From: | Neil Conway <neilc(at)samurai(dot)com> |
|---|---|
| To: | cgg007(at)yahoo(dot)com |
| Cc: | PostgreSQL General <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: 7.3 LOCK TABLE problem |
| Date: | 2003-01-27 20:36:55 |
| Message-ID: | 1043699815.32114.182.camel@tokyo |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Mon, 2003-01-27 at 15:21, Chris Gamache wrote:
> BEGIN;
> LOCK TABLE queue IN EXCLUSIVE MODE;
> UPDATE queue
> set status=$$
> WHERE id = (SELECT min(id)
> FROM queue
> WHERE status=0);
This is unrelated, but note that the sub-select would probably be faster
written as:
SELECT id FROM queue WHERE status = 0 ORDER BY id ASC LIMIT 1;
As this form of the query can use a btree index on "id" if one's
present.
> SELECT id, data
> FROM queue
> WHERE status=$procid;
My Perl's a bit rusty, but AFAICS $procid is undefined. Perhaps 'perl
-w' and "use strict;" would be a good idea?
Cheers,
Neil
--
Neil Conway <neilc(at)samurai(dot)com> || PGP Key ID: DB3C29FC
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Matt Mello | 2003-01-27 20:39:57 | Indexing foreign keys |
| Previous Message | Zengfa Gao | 2003-01-27 20:30:50 | pg_dump: Attempt to lock table "contexthelp" failed. |