BulkAction too many records, can we chunk these?
I'm running into an issue with a bulk table action. The table has approximately 2500 records but SQL Server has a parameter limit of 2100. Therefore, if I try to run a bulk action on the entire table I get the following error:
SQLSTATE[IMSSP]: Tried to bind parameter number 2101. SQL Server supports a maximum of 2100 parameters.Is it possible to chunk these before being passed into the
action
method?
This is what I mean by the parameter limit:
Solution:Jump to solution
This turned out to be an issue only when using string keys rather than integer keys. Laravel apparently does not parameterize integer keys anymore as demonstrated here: https://github.com/laravel/framework/pull/26434
This specific query is to a view rather than a table referencing our ERP database and so I don't really have control over the schema.
In turn, I've managed to work around this issue by implementing an ETL pipeline that runs every minute to use SQL Server's MERGE statement (https://learn.microsoft.com/en-us/sql/t-sql/statements/merge-transact-sql?view=sql-server-ver16&redirectedfrom=MSDN) to sync the view into a real table which is using auto-incrementing surrogate keys....
GitHub
[5.7] Improve eager loading performance on MySQL by staudenmeir · P...
There is an old bug in the PDO implementation for MySQL that slows down larges WHERE IN queries. When the query has a few thousand bindings, the time execution time of fetchAll() increases non-line...
MERGE (Transact-SQL) - SQL Server
MERGE (Transact-SQL)
1 Reply
Solution
This turned out to be an issue only when using string keys rather than integer keys. Laravel apparently does not parameterize integer keys anymore as demonstrated here: https://github.com/laravel/framework/pull/26434
This specific query is to a view rather than a table referencing our ERP database and so I don't really have control over the schema.
In turn, I've managed to work around this issue by implementing an ETL pipeline that runs every minute to use SQL Server's MERGE statement (https://learn.microsoft.com/en-us/sql/t-sql/statements/merge-transact-sql?view=sql-server-ver16&redirectedfrom=MSDN) to sync the view into a real table which is using auto-incrementing surrogate keys.
GitHub
[5.7] Improve eager loading performance on MySQL by staudenmeir · P...
There is an old bug in the PDO implementation for MySQL that slows down larges WHERE IN queries. When the query has a few thousand bindings, the time execution time of fetchAll() increases non-line...
MERGE (Transact-SQL) - SQL Server
MERGE (Transact-SQL)