I have API that returns dome paginated rows from DB. It works, however when I order rows by RANDOM()
I get duplicates on consecutive pages. Is there any option to set random seed per query?
If not is it possible to set random SEED globally to force RANDOM()
to generate same values per query? Then I could just change global random every 3 minutes or something like that...
U use this code:
SELECT * FROM "table" ORDER BY RANDOM() OFFSET 5 LIMIT 5
Now I want pass seed to this query so I can paginate random results. I should do this like this?:
SELECT "table".*, SETSEED(0.1) FROM "table" ORDER BY RANDOM() OFFSET 5 LIMIT 5
SELECT "table".*, SETSEED(0.1) FROM "table" ORDER BY RANDOM() OFFSET 10 LIMIT 5
And results will be correctly paginated?