echo 'Making file for import...'

cd /tmp
echo '"1234567";"223";"cxycxcxxxc"' >xx

# It was enough for me. You may increase this value for faster machines
let i=16 

while [ $i -ge 0 ]
do
  cat xx xx > yy; mv yy xx
  let i=i-1
done

ls -l xx
rm t1
ln -s xx t1
echo 'File prepared'

# It is my basedir for MySQL
cd /home/openxs/dbs/4.1

echo 'Creating table...'
bin/mysql -uroot test <<EOF
DROP TABLE IF EXISTS t1; 
CREATE TABLE t1 (
  xx decimal(12,0) default NULL,
  yy smallint(6) default NULL,
  zz char(60) default NULL, 
  KEY (xx,yy),  KEY (yy,xx),  KEY (zz,xx), KEY (yy,zz)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
EOF

echo 'Table created'

bin/mysqlimport -h 127.0.0.1 -u root test /tmp/t1 &
bin/mysql -uroot test <<EOF
show index from t1;
select count(*) from t1;
show index from t1;
select 'Execution plans after loading';
explain select * from t1 where zz=222; 
explain select * from t1 where yy=222; 
explain select * from t1 where xx=222;
flush tables;
select 'Execution plans after flushing';
explain select * from t1 where zz=222; 
explain select * from t1 where yy=222; 
explain select * from t1 where xx=222;
EOF

echo 'So, indexes are not even considered until fuls tables performed. Is it OK?'
