List:General Discussion« Previous MessageNext Message »
From:Elim PDT Date:September 17 2010 6:28pm
Subject:prime number table
View as plain text  
I got a file of the list of the 1st 1270607 prime numbers (the 1270607th 
prime is 19999999,
beat the $227 book at 
http://www.amazon.com/prime-numbers-Carnegie-institution-Washington/dp/B0006AH1S8). 
the file is an output of a python script. the file size is about 12Mb.

Then I created a simeple mysql table prime as

mysql> desc prime;
+----------+------------------+------+-----+---------+----------------+
| Field    | Type             | Null | Key | Default | Extra          |
+----------+------------------+------+-----+---------+----------------+
| oid      | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| pv       | int(10) unsigned | YES  |     | NULL    |                |
| descript | text             | YES  |     | NULL    |                |
+----------+------------------+------+-----+---------+----------------+
mysql> show create table prime;
--------------------------------------------------------------------------+
| Table | Create Table
--------------------------------------------------------------------------+
| prime | CREATE TABLE `prime` (
  `oid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `pv` int(10) unsigned DEFAULT NULL,
  `descript` text,
  PRIMARY KEY (`oid`)
) ENGINE=MyISAM AUTO_INCREMENT=1270608 DEFAULT CHARSET=latin1

The table file size is (prime.frm,prime.MYD,prime.MYI) = (9k; 24,817KB; 
12,754KB)

Then I do
mysql> create table prm select * from prime order by prime.oid;
mysql> alter table prm modify oid int unsigned primary key auto_increment;

mysql> desc prm;
+----------+------------------+------+-----+---------+----------------+
| Field    | Type             | Null | Key | Default | Extra          |
+----------+------------------+------+-----+---------+----------------+
| oid      | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| pv       | int(10) unsigned | YES  |     | NULL    |                |
| descript | text             | YES  |     | NULL    |                |
+----------+------------------+------+-----+---------+----------------+

mysql> show create table prm;
+-------+------------------------------------------------------------------
| Table | Create Table
+-------+------------------------------------------------------------------
| prm   | CREATE TABLE `prm` (
  `oid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `pv` int(10) unsigned DEFAULT NULL,
  `descript` text,
  PRIMARY KEY (`oid`)
) ENGINE=InnoDB AUTO_INCREMENT=1270608 DEFAULT CHARSET=latin1 |
+-------+------------------------------------------------------------------

The table file prm.frm is only 9KB

My question is that how come it's SO SMALL? (currently the colum description
in both tables prime and prm are empty except one identical row, with very
short string value.

Is is recommend to index the other twoo columns?

Thanks 

Thread
Encryption with MYSQLTompkins Neil17 Sep
  • Re: Encryption with MYSQLJohan De Meersman17 Sep
  • prime number tableElim PDT17 Sep
    • RE: prime number tableGavin Towey17 Sep
    • Re: prime number tableChris W18 Sep
  • Re: prime number tableElim PDT21 Sep
Re: Encryption with MYSQLTompkins Neil20 Sep
  • Re: Encryption with MYSQLBaron Schwartz20 Sep