Support the ongoing development of Laravel.io →
posted 8 years ago
Database

Started having the following errors as the size of my database grow. It's at about 4GB now for this table with millions of rows.

Laravel cant handle large tables?

$count = DB::table('table1')->distinct('data')->count(["data"]); $count2 = DB::table('table2')->distinct('data')->count(["data"]); SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. (SQL: select count(distinct data) as aggregate from data)

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.