private static function get_insert_batch_size(): int {
        global $DB;

        $dbconfig = $DB->export_dbconfig();

        // 500 is pgsql default so using 1000 is fine, no other db driver uses a hardcoded value.
        if (empty($dbconfig) || empty($dbconfig->dboptions) || empty($dbconfig->dboptions['bulkinsertsize'])) {
            return 1000;
        }

        $bulkinsert = $dbconfig->dboptions['bulkinsertsize'];
        if ($bulkinsert < 1000) {
            return $bulkinsert;
        }

        while ($bulkinsert > 1000) {
            $bulkinsert = round($bulkinsert / 2, 0);
        }

        return (int)$bulkinsert;
    }
private static function get_insert_batch_size(): int {
        global $DB;

        $dbconfig = $DB->export_dbconfig();

        // 500 is pgsql default so using 1000 is fine, no other db driver uses a hardcoded value.
        if (empty($dbconfig) || empty($dbconfig->dboptions) || empty($dbconfig->dboptions['bulkinsertsize'])) {
            return 1000;
        }

        $bulkinsert = $dbconfig->dboptions['bulkinsertsize'];
        if ($bulkinsert < 1000) {
            return $bulkinsert;
        }

        while ($bulkinsert > 1000) {
            $bulkinsert = round($bulkinsert / 2, 0);
        }

        return (int)$bulkinsert;
    }
private static function get_insert_batch_size ( ) : int { global $ DB ; $ dbconfig = $ DB -> export_dbconfig ( ) ; // 500 is pgsql default so using 1000 is fine, no other db driver uses a hardcoded value. if ( empty ( $ dbconfig ) || empty ( $ dbconfig -> dboptions ) || empty ( $ dbconfig -> dboptions [ 'bulkinsertsize' ] ) ) { return 1000 ; } $ bulkinsert = $ dbconfig -> dboptions [ 'bulkinsertsize' ] ; if ( $ bulkinsert < 1000 ) { return $ bulkinsert ; } while ( $ bulkinsert > 1000 ) { $ bulkinsert = round ( $ bulkinsert / 2 , 0 ) ; } return ( int ) $ bulkinsert ; }
Returns the batch size used for insert_records.

This method tries to find the best batch size without getting
into dml internals. Maximum 1000 records to save memory.

@return int
Returns the batch size used for insert_records .