Skip to content

Instantly share code, notes, and snippets.

@thomas-0816
thomas-0816 / bulk_insertion.php
Last active October 3, 2026 15:45
How long does it take for PHP to insert 1 million rows into a database? duckdb
<?php
/*
run:
rm -rf /tmp/db.duckdb && cat bulk_insertion.php && echo && time php8.6 bulk_insertion.php && ls -lisah /tmp/db.duckdb
Test results: Ubuntu 24.04, Kernel 6.17, PHP 8.6.0beta3 (nts), AMD 7840U, DDR5 6400 MT/s
0.66s for the bulk insertion
0.933s total time for running PHP (data generation, create table, insert, select)