jms
jms

Reputation: 795

MySQL INSERT DELAYED - How to find out when inserts are done

When using MySQL's INSERT DELAYED statements, is there a way to force all Inserts to execute before continuing? Or alternatively to find out whether the Inserts are done yet?

Upvotes: 4

Views: 7683

Answers (2)

Johan
Johan

Reputation: 76753

You can find out by doing a

SHOW STATUS LIKE 'Not_flushed_delayed_rows'

For for more info

SHOW STATUS LIKE '%delay%'

Note that INSERT DELAYED has a few issues you need to be aware of please read the first link below for more info.

FLUSH TABLES

Will force an immediate insert of the delayed rows.

See: http://dev.mysql.com/doc/refman/5.5/en/insert-delayed.html
and: http://dev.mysql.com/doc/refman/5.5/en/show-status.html

Upvotes: 6

Vladislav Rastrusny
Vladislav Rastrusny

Reputation: 30013

Well, if you need to know when they are completed, why to mark them DELAYED?

Also, using these can be dangerous for example because

Pending INSERT DELAYED statements are lost if a table is write locked and ALTER TABLE is used to modify the table structure.

To force all DELAYED statements to execute, call FLUSH TABLES.

Manual link.

Upvotes: 2

Related Questions