You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I've noticed this SQL SELECT * FROM items ORDER BY RANDOM() LIMIT 1 in your database.
What it does, as far as I know, is it orders WHOLE database in some random way, then selects first element. This is really slow way of fetching one random row.
Faster way of doing this is generating random number (between 0 and table size) and then doing something like SELECT * FROM items WHERE ID = <generated number>". (It seems you don't have ID column, but column Unnamed: 0 looks like ID-like column, so making it primary key is a good idea)
The text was updated successfully, but these errors were encountered:
Hi, I've noticed this SQL
SELECT * FROM items ORDER BY RANDOM() LIMIT 1
in your database.What it does, as far as I know, is it orders WHOLE database in some random way, then selects first element. This is really slow way of fetching one random row.
Faster way of doing this is generating random number (between 0 and table size) and then doing something like
SELECT * FROM items WHERE ID = <generated number>"
. (It seems you don't have ID column, but columnUnnamed: 0
looks like ID-like column, so making it primary key is a good idea)The text was updated successfully, but these errors were encountered: