[ticket/11420] Flush to DB after 500 rows.

PHPBB3-11420