Hi, from quickly searching the source code of NextGen gallery it seems that the php code you posted is from the function that updates meta data for
one image (the one whose
pid matches
$id). So this database query should only return one row. I browsed through the calls to this function and it doesn't look like anyone's looping through a huge amount of images, at a maximum only the number of images that you're uploading. What makes you so sure this query is returning such a huge amount of rows? Please note that I'm no expert in NextGen Gallery, I just happen to have a copy of the sources.
