lundi 21 février 2022

Would it be possible to select random rows with a little preference for a specific column?

I would like to get a random selection of records from my table but I wonder if it would be possible to give a better chance for items that are newly created. I also have pagination so this is why I'm using setseed

Currently I'm only retrieving items randomly and it works quite well, but I need to give a certain "preference" to newly created items.

Here is what I'm doing for now:

SELECT SETSEED(0.16111981), RANDOM();

I don't know what to do and I can't figure what can be a good solution without being an absolute performance disaster.




Aucun commentaire:

Enregistrer un commentaire