mySQL memory engine : is max nrows 2^32? -
it seems maximum number of rows mysql memory engine table can have 2^32 - 1. worryingly, when add 1 more row, table becomes empty.
is known behaviour (it's not documented in manual), or doing wrong when create table ?
i'm using out of box mysql server ver 14.14 distrib 5.5.57, on r4.16xlarge aws instance. don't observe such limit myisam / innodb tables.
mysql> select count(*) big_ram ; +------------+ | count(*) | +------------+ | 4294967295 | +------------+ 1 row in set (0.00 sec) mysql> insert big_ram values ('aaaa','bbbb') ; query ok, 1 row affected (0.00 sec) mysql> select count(*) big_ram ; +----------+ | count(*) | +----------+ | 0 | +----------+ 1 row in set (0.00 sec) mysql> select * big_ram limit 10 ; empty set (0.00 sec) the table created , populated statement. interestingly, 'show table status' reports 'create_options: min_rows=4294967295'
create table big_ram ( s1 char(4) , s2 char(4) ) min_rows=5000000000 , engine=memory ; load data local infile '/ramdisk/data.csv' table big_ram fields terminated ',' lines terminated '\n' (s1,s2) ; for interested or willing replicate behaviour, big csv file created bash script (in couple of minutes if you're using ramdisk):
df1=/ramdisk/data.csv df2=/ramdisk/data2.csv # number of lines 2^p : 32 gives 4g rows p=32 cat > ${df1} <<- eof abcd,defg abcd,defg eof n=2 in $(seq 2 ${p}) cat ${df1} ${df1} > ${df2} && mv ${df2} ${df1}; n=$(( n * 2 )) fs=$( du -h ${df1} | cut -f1 ) echo "$i : $fs : $n lines : in ${seconds} secs" done # remove couple of lines sed -i -e '1,5d' ${df1}
Comments
Post a Comment