---
title: "Insert 1M Rows to MySQL Laravel DB: 6 Ways (Benchmarks)"
url: https://daily.dev/posts/insert-1m-rows-to-mysql-laravel-db-6-ways-benchmarks--fqntd5vtm
source_url: https://www.youtube.com/watch?v=XEZlnoC2Hm0
type: video:youtube
source: "Laravel Daily"
published: 2026-05-14T10:06:11.433Z
updated: 2026-05-14T10:06:28.306Z
tags: ["php", "laravel", "mysql"]
reading_time: 9
upvotes: 29
comments: 1
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Insert 1M Rows to MySQL Laravel DB: 6 Ways (Benchmarks)

**[Laravel Daily](https://daily.dev/sources/laraveldaily)** · 9 min read · 29 upvotes · 1 comments

## Summary

Benchmarks comparing 6 approaches to inserting 1 million rows into a MySQL database using Laravel, including Eloquent, factories, query builder, raw DB insert, and bulk native file loading. Key findings: bulk native (LOAD DATA INFILE) is fastest at ~5.5 seconds, while plain Eloquent is slowest due to per-row overhead like password hashing and timestamp generation. Factories are significantly faster than Eloquent for users because they hash the password only once. Query builder and raw DB insert achieve ~100,000 rows/second vs ~4,000 for factories. Also covers a streaming/chunked approach to minimize RAM usage (reducing peak memory from ~560MB to a stable low level) at the cost of slightly slower execution.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=XEZlnoC2Hm0>

## Community discussion

Top comments from developers on daily.dev.

**@bakale** · 0 upvotes

> Interesting benchmark. In real production environments, I’ve noticed that raw bulk inserts and chunked `DB::table()->insert()` operations usually scale much better than full Eloquent model creation when dealing with millions of rows.
>
> One thing benchmarks often miss is the impact of indexes, foreign keys, transactions, and server I/O. A method that performs well locally may behave differently on a shared VPS or under concurrent traffic.
>
> I’d also be curious to see `LOAD DATA INFILE` included in the comparison since MySQL can sometimes outperform traditional inserts by a huge margin for bulk...

## Similar posts on daily.dev

- [Once again processing 11 million rows, now in seconds](https://daily.dev/posts/once-again-processing-11-million-rows-now-in-seconds-oqf9cnfsn) · stitcher.io · 98 upvotes · 1 comments

---

Tags: [#php](https://daily.dev/tags/php), [#laravel](https://daily.dev/tags/laravel), [#mysql](https://daily.dev/tags/mysql)

[View this post on daily.dev](https://daily.dev/posts/insert-1m-rows-to-mysql-laravel-db-6-ways-benchmarks--fqntd5vtm)
