Re: READ UNCOMMITTED in postgres

Stephen Frost <[email protected]> Wed, 18 Dec 2019 18:20:03 -0500
Newsgroups gmane.comp.db.postgresql.general
Message-ID <[email protected]>
Greetings,

* Matthew Phillips ([email protected]) 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
signature.asc (application/pgp-signature, 819 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCgAGBQJd+rQiAAoJEO1sijiDR2RVmO4P+gP31abaGtImYqq2RKWkGwTL
9H5STEiqlHXNhy+rfzGnTKcissnNMbRKO0sJNU5ZhN8u3Y4wphUJZHBQHZKBk4lq
DP9yYkbx7Hysfz3n8DhNcOj9Jl4501SqFRLn85l2ov+DC42dtXvoAZHd0VjcNCxl
nXDf95EsYvwhpy4MYqzSvum8l5Qk5StMXYJdZNLEDcQu5XXTYcQ0b5BOJ98UQW2f
x7aFHGBH05L6Ihh2SpjMnEtINmp3u3e3ZfD+TrQOqvTElR1KxBgxXTM7B99GUglZ
Iixm8YJNL3GIbc7eyz4X/U9YTlMTo9UjnDfJQoPspOOri5li7RMlZSyHJwPb6Hyc
+AwIr+0Vb727O+5Y5+naEnguYXY3IjQ1p0o8+3O+5BkZGe9T9qYlhnJ4YOnUut+p
JTmKjAPhWMyyawns3eJ9XrBm3LJefXxo2VieYtMmivSs5mRCSiw9BpPScMwaOXIt
J7Ouxkhlh99qDEW2S2ccdAzP0WFn2bgT8MpFnB8GgSfiLT+V7diZISIGRAzNb2zy
V+F9wF+6jDAYOvIFGgTK2XPAow8y0qKRNaw19Fzb8crIA/z2MzaEyaqhpiNQE+DH
6H+jgFwf5J5pFLE4kD3DIJCl5eQYZjNOQWJQWgN0CE3S2y2Vj/Xfq0axVdHJxFKr
kmlppXrngFoWmYZ9boda
=cNqS
-----END PGP SIGNATURE-----