Sort an index Mysql
For sorting an index and data according to an index, use
(assuming that you want to sort on index 1).
This is the best way to make queries faster if you have a unique index from which you want to read all rows in order according to the index.
However, the first time you sort a large table this way, it may take a long time.
- Kiran's blog
- Add new comment
- 152 reads
Concurrent Inserts For MyISAM
MyISAM storage engine supports concurrent inserts. If there are multiple INSERT statements, they are queued and performed in sequence, concurrently with the SELECT statements.
The concurrent_insert system variable can be set to modify the concurrent-insert processing. This variable is set to 1 by default. To disable concurrent insert just set concurrent_insert variable to 0. If the variable is set to 2, concurrent inserts at the end of the table are allowed even for tables that have deleted rows. See also the description of the concurrent_insert system variable.
- Kiran's blog
- Add new comment
- 154 reads
Refresh Index Statistics MySQL
If frequent changes happens on a table, it may develop some inefficiencies in its indexes. Fragmentation due to blocks moving around on disk and inaccurate index statistics are the two most common problems you're likely to see. However, one cay easily optimize index data for MyISAM tables.
For reindexing a table we can use OPTIMIZE TABLE command. In doing so, MySQL try reading the records again in the table and reconstruct all of its indexes. This will result in indexes with good statistics.
However, reindexing the table takes lot of time if the table size is huge. During that time, MySQL also has a write lock on the table, so data can't be updated.
For offline analysis you can try myisamchk command-line tool:
$ cd your-database-name
$ myisamchk table-name
You need to make sure that MySQL isn't running when you try this, or you run the risk of corrupting your indexes.
- Kiran's blog
- 2 comments
- Read more
- 710 reads
EXPLAIN statement MySQL
EXPLAIN statement can be used in two ways.
First, you can use EXPLAIN table;
This gives very similar output to DESCRIBE table or SHOW COLUMNS FROM table.
- Kiran's blog
- Add new comment
- Read more
- 195 reads
Characteristics of Cursor MYSQL
Here is a brief characteristics of cursor in MYSQL
READ ONLY
NOT SCROLLABLE
ASENSITIVE
- Kiran's blog
- Add new comment
- Read more
- 236 reads













