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
add random_no INT column to items table and index it. Set it to Math.round(Math.random()*ROUGHLY_TABLE_SIZE)) when creating a record (and consider updating it in a beforeUpdate hook - or whatever the node version of that is..)
That way we can select random items via:
var rnd = Math.random()
var pivot = rnd * ROUGHLY_TABLE_SIZE
var direction = rnd > 0.5 ? '>=' : '<'
var sql = `SELECT * FROM items WHERE random_no ${dir} ${pivot} LIMIT ${LIMIT}`
.. something like that..
The text was updated successfully, but these errors were encountered:
add
random_no INT
column toitems
table and index it. Set it to Math.round(Math.random()*ROUGHLY_TABLE_SIZE)) when creating a record (and consider updating it in abeforeUpdate
hook - or whatever the node version of that is..)That way we can select random items via:
.. something like that..
The text was updated successfully, but these errors were encountered: