Engineering hacks

Tips and tricks from engineers at the leading prediction cloud for B2C brands.

How to generate UUID ranges for SQL queries

How to generate UUID ranges for SQL queries

So you've got a table with a UUID primary key. How do you search for only 1/4, or 1/8, or 1/128 of it? BETWEEN '00000000-0000-0000-0000-000000000000' AND '3fffffff-ffff-ffff-ffff-ffffffffffff' BETWEEN '40000000-0000-0000-0000-000000000000' AND '7fffffff-ffff-ffff-ffff-ffffffffffff' BETWEEN '80000000-0000-0000-0000-000000000000' AND 'bfffffff-ffff-ffff-ffff-ffffffffffff' BETWEEN 'c0000000-0000-0000-0000-000000000000' AND 'ffffffff-ffff-ffff-ffff-ffffffffffff' And how do you generate those ranges? Here