Unix Technical Forum

creating indexes with myisamchk

This is a discussion on creating indexes with myisamchk within the MySQL General forum forums, part of the MySQL category; --> Good evening, I've got to create a very large table: 180GB of data has to be stored. In order ...


Go Back   Unix Technical Forum > Database Server Software > MySQL > MySQL General forum

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 07:02 AM
Joris Kinable
 
Posts: n/a
Default creating indexes with myisamchk

Good evening,

I've got to create a very large table: 180GB of data has to be stored.
In order to to this I'm using the following steps:

1. Create database structure including keys.
2. Disable keys: ALTER TABLE ut_netflow_4 DISABLE KEYS
3. Load data into the database.
4. Generate all index keys: myisamchk --sort_buffer_size=2700M
--key_buffer_size=2700M -r --tmpdir=/tmpdir --quick /ut_netflow_4.MYI
5. flush privileges: FLUSH TABLE ut_netflow_4
6. restart server.

Everything up to step 3 goes great. Step 4 and 5 on the other hand do
not seem to work. After running the command at step 4, I've got a huge
ut_netflow_4.MYI index file, but none of the indexes seem to be
enabled. If I use phpmysql to view the table, it says that the
cardinalities of the indexes are 0. Instead of the command at step 4,
I've also tried:
-myisamchk --sort_buffer_size=2700M --key_buffer_size=2700M
--sort-recover /ut_netflow_4.MYI
-myisamchk --sort_buffer_size=2700M --key_buffer_size=2700M
--parallel-recover /ut_netflow_4.MYI
-myisamchk --sort_buffer_size=2700M --key_buffer_size=2700M -r /ut_netflow_4.MYI
None of these seem to work either. The index file becomes larger, but
phpmyadmin keeps indicating that there are no indexes.

What am I doing wrong? How can I create and enable the indexes after
loading the data into the table?

Thnx in advance,

Joris
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 07:02 AM
Baron Schwartz
 
Posts: n/a
Default Re: creating indexes with myisamchk

Joris Kinable wrote:
> Good evening,
>
> I've got to create a very large table: 180GB of data has to be stored.
> In order to to this I'm using the following steps:
>
> 1. Create database structure including keys.
> 2. Disable keys: ALTER TABLE ut_netflow_4 DISABLE KEYS
> 3. Load data into the database.
> 4. Generate all index keys: myisamchk --sort_buffer_size=2700M
> --key_buffer_size=2700M -r --tmpdir=/tmpdir --quick /ut_netflow_4.MYI
> 5. flush privileges: FLUSH TABLE ut_netflow_4
> 6. restart server.
>
> Everything up to step 3 goes great. Step 4 and 5 on the other hand do
> not seem to work. After running the command at step 4, I've got a huge
> ut_netflow_4.MYI index file, but none of the indexes seem to be
> enabled. If I use phpmysql to view the table, it says that the
> cardinalities of the indexes are 0. Instead of the command at step 4,
> I've also tried:
> -myisamchk --sort_buffer_size=2700M --key_buffer_size=2700M
> --sort-recover /ut_netflow_4.MYI
> -myisamchk --sort_buffer_size=2700M --key_buffer_size=2700M
> --parallel-recover /ut_netflow_4.MYI
> -myisamchk --sort_buffer_size=2700M --key_buffer_size=2700M -r /ut_netflow_4.MYI
> None of these seem to work either. The index file becomes larger, but
> phpmyadmin keeps indicating that there are no indexes.
>
> What am I doing wrong? How can I create and enable the indexes after
> loading the data into the table?


In step 4, I'd just do ALTER TABLE ENABLE KEYS. Manipulating MyISAM
files externally while the server is running is asking for trouble, in
my opinion.

In step 5, you aren't flushing privileges. You're flushing the table to
disk. But it's already flushed to disk, since you did step 4
externally. The restart will do the same thing.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:45 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com