kolypto
kolypto

Reputation: 35453

Is it possible to do a non-blocking read of MyISAM table?

I have a log table with heavy write operations: that was the reason of choosing MyISAM for it.

Now I need to execute a complicated SELECT query which takes a lot time and blocks the table: no one can write to it then.

What are the options to read the data without blocking the table?

Upvotes: 1

Views: 813

Answers (1)

Jürgen Steinblock
Jürgen Steinblock

Reputation: 31743

Some suggestions, maybe one or the other is suitable for you

  1. option: Slave

    Configure a slave that you use for your SELECT query. That won't block the inserts. However, this requires a second server, some configuration and storage space, so this is not a good solution, just to get your data.

  2. option: use low-priority-updates: http://dev.mysql.com/doc/refman/5.0/en/table-locking.html

    This can be done on a server level or connection level, so you don't have to modify every insert statement.

  3. worker process

    • Make your inserts as usual.
    • create a worker process that "moves" your log entries (for each row in table A, make a insert in table B, delete row in Table A) to another table.
    • Now you can query Table B

Upvotes: 2

Related Questions