Re: READ UNCOMMITTED in postgres

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Matthew Phillips <mphillips34(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: READ UNCOMMITTED in postgres
Date: 2019-12-18 23:20:03
Message-ID: 20191218232003.GZ3195@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greetings,

* Matthew Phillips (mphillips34(at)gmail(dot)com) wrote:
> With the current READ UNCOMMITTED discussion happening on pgsql-hackers
> [1], It did raise a question/use-case I recently encountered and could not
> find a satisfactory solution for. If someone is attempting to poll for new
> records on a high insert volume table that has a monotonically increasing
> id, what is the best way to do it? As is, with a nave implementation, rows
> are not guaranteed to appear in monotonic order; so if you were to keep a
> $MAX_ID, and SELECT WHERE p_id > $MAX_ID, you would hit gaps. Is there a
> clean way to do this? I've seen READ UNCOMMITTED used for this with DB2.

There's the LISTEN/NOTIFY system, which at a high level is a better
approach than using a polling system.

Thanks,

Stephen

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2019-12-19 00:06:27 Re: AccessExclusiveLock with pg_locks.locktype of tuple
Previous Message Matthew Phillips 2019-12-18 23:12:55 READ UNCOMMITTED in postgres