Filtering by UUID - Mailing list pgsql-general

From Colin Morelli
Subject Filtering by UUID
Date
Msg-id CAPtU-UrkgRAJ1iMYFKBjtPZthmmQtkw-H9mJHKi-VX_kV2jHZA@mail.gmail.com
Whole thread Raw
Responses Re: Filtering by UUID  (Guyren Howe <guyren@gmail.com>)
List pgsql-general
Hey list,

I'm using UUID primary keys in my application. I need to add pagination, and am trying to avoid OFFSET/LIMIT. I do have a created_at timestamp that I could use, but it's possible for multiple records to be created at the same timestamp (postgres offers millisecond precision here, I believe?)

Is there an efficient way to filter based on the time component of UUID v1s? WHERE id > 'some-uuid' doesn't seem to work, as it looks like it's just performing a lexicographic sort on the hex representation of the UUID. Or, alternatively, does anyone have other suggestions on paginating large data sets?

Best,
Colin

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] pg_upgrade from 9.5 to 9.6 fails with "invalid argument"
Next
From: Guyren Howe
Date:
Subject: Re: Filtering by UUID