From 8c5fcac2325356bacb72517f6fbd95f9bfdaf16d Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 27 Mar 2013 18:22:59 +0100 Subject: [ticket/11469] Add benefits over collecting huge insert arrays to class doc. PHPBB3-11469 --- phpBB/includes/db/sql_insert_buffer.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'phpBB') diff --git a/phpBB/includes/db/sql_insert_buffer.php b/phpBB/includes/db/sql_insert_buffer.php index 6b884dd412..4bf0608227 100644 --- a/phpBB/includes/db/sql_insert_buffer.php +++ b/phpBB/includes/db/sql_insert_buffer.php @@ -19,6 +19,18 @@ if (!defined('IN_PHPBB')) * Collects rows for insert into a database until the buffer size is reached. * Then flushes the buffer to the database and starts over again. * +* Benefits over collecting a (possibly huge) insert array and then using +* $db->sql_multi_insert() include: +* +* - Going over max packet size of the database connection is usually prevented +* because the data is submitted in batches. +* +* - Reaching database connection timeout is usually prevented because +* submission of batches talks to the database every now and then. +* +* - Usage of less PHP memory because data no longer needed is discarded on +* buffer flush. +* * Usage: * * $buffer = new phpbb_db_sql_insert_buffer($db, 'test_table', 1234); -- cgit v1.2.1