Aaron Waller
05/18/2022, 3:23 PMprisma.posts.count(); I can get the Table size, and with Math.random() I generated 10 random int values.
How can I now query my database and get 10 random posts?Aaron Waller
05/18/2022, 3:28 PMDonald Wu
05/18/2022, 4:00 PMRuben Amendoeira
05/18/2022, 4:24 PMRuben Amendoeira
05/18/2022, 4:27 PM0123456789abcdef), if you were to do a "starts with random hex character" query on something like
WHERE "id" LIKE %{RANDOM_CHARACTER}
it should atleast reduce the returned rows to 1/16th the size of an "select all" query.
I'm also unsure of how efficient these pattern matching queries are, and what the tradeoffs would be, but hey, it's just an idea 🤷Omar
05/18/2022, 6:54 PMJason Kleinberg
05/18/2022, 8:47 PMprisma.$queryRaw('SELECT * FROM posts ORDER BY RAND() LIMIT 10')Jason Kleinberg
05/18/2022, 8:47 PMAaron Waller
05/19/2022, 7:28 AMJason Kleinberg
05/19/2022, 1:08 PMNurul
05/25/2022, 10:48 AM