It should be noted that the $nids array argument to the node_load_multiple() function should be limited in size to avoid a PDO error like #1210092: PDOException: SQLSTATE[HY000]: General error: 1 too many SQL variables: SELECT t.* FROM {field_data_body} t WHERE (entity_type =

CommentFileSizeAuthor
node_load_multiple-limits.patch1.17 KBpillarsdotnet

Comments

joachim’s picture

Looks good, but do we have actual figures on how much is too much?

pillarsdotnet’s picture

I know that 2000 produces an error on my system and 1000 does not. I am not willing to perform exhaustive testing under a wide variety of database drivers, PHP versions, memory limits, operating systems, etc. Maybe someone else with better resources would be willing to take on that task.

droplet’s picture

Category: bug » task

What limit it ?? physical RAM ?? I doubt we should docs it

How do you test it ??

Im just tested in a little virtual box

echo memory_get_usage() / 1024 . "<br/>";
$loaded_node = node_load_multiple(range(1, 5000));
echo memory_get_usage() / 1024 . "<br/>";
echo count($loaded_node);

5538.796875
68001.9453125
4002

Page execution time was 5530.62 ms. Memory used at: devel_boot()=1.12 MB, devel_shutdown()=66.22 MB, PHP peak=75.25 MB.

** DOCS is a task

joachim’s picture

> What limit it ?? physical RAM ?? I doubt we should docs it

Well a ballpark figure would help people reading this wondering, 'well, is 12 okay?'

> ** DOCS is a task

depends, actually. Missing docs or errors in docs are a bug.

jhodgdon’s picture

Status: Active » Closed (duplicate)

This is a duplicate of #1210606: Document that operations that delete in bulk can hit limits for the number of arguments, which has a better idea (IMO) of how to document this and related functions' limitations.