Strange ...
As I can see you get 5 random rows and thats the result I’m looking for.
I only get this result when running ‘order by rand() limit 5’ in myISAM
se examples below ....
Thankyou
/Catarina
CREATE TABLE `temp_table` (
`id` int(11) NOT NULL DEFAULT ‘0’,
`idx` int(11) NOT NULL DEFAULT ‘0’,
`value` double DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE `temp_table_ib` (
`id` int(11) DEFAULT NULL,
`idx` int(11) DEFAULT NULL,
`value` int(11) DEFAULT NULL
) ENGINE=BRIGHTHOUSE DEFAULT CHARSET=latin1
I fill the two tables with index 0 to 220000
ex.
‘10’, ‘0’, ‘2.83’
‘10’, ‘100’, ‘2.52’
‘10’, ‘200’, ‘1.9’
‘10’, ‘300’, ‘1.94’
‘10’, ‘400’, ‘1.9’
‘10’, ‘500’, ‘1.89’
‘10’, ‘600’, ‘1.66’
‘10’, ‘700’, ‘1.44’
‘10’, ‘800’, ‘1.3’
etc.
select idx from temp_table_ib order by rand() limit 5;
‘400’
‘200’
‘0’
‘300’
‘100’
select idx from temp_table_ib order by rand() limit 5;
‘100’
‘200’
‘400’
‘300’
‘0’
etc.
select idx from temp_table order by rand() limit 5;
‘33800’
‘76200’
‘94500’
‘222100’
‘35000’
select idx from temp_table order by rand() limit 5;
‘224700’
‘81700’
‘171500’
‘193700’
‘77300’