I'm a bit new to all this D7 stuff, but I was generating content using devel generate, and tried to create 500,000 items. It was taking a long time to complete, and so I investigated, and the line that was taking a long time to execute was:
class BatchQueue extends SystemQueue {
public function claimItem($lease_time = 0) {
$item = db_query('SELECT data, item_id FROM {queue} q WHERE name = :name ORDER BY item_id ASC', array(':name' => $this->name))->fetchObject();
Which was returning 500,000 rows from the db to just get the first one :( Sad times.
Patch on its way.
Comments
Comment #1
steven jones commentedPatch attached. Let's see what the testbot thinks.
Comment #2
moshe weitzman commentedOuch. Nice catch.
Comment #3
webchickD'oh! :)
Committed to HEAD. Thanks!
Comment #6
donquixote commentedThis can still take longer than needed, if the "data" column contains large chunks.
Internally, it seems MySQL works like this:
We have a case here with search_api_et, but it is possible that there is a bug in our code or in search_api_et that causes the data to be so big.
Still, it would be useful to optimize this one step further.
Comment #7
donquixote commentedThe case I ran into was indeed due to a bug in search_api_et:
#3124298: Huge data size in batch queue items
Still it would be useful to optimize.
The solution is quite simple:
Btw, some observations:
This suggests that we are dealing with a memory issue, not a performance issue.
I am going to create a new issue for this.
Comment #8
donquixote commentedNew issue: #3124304: DatabaseQueue::claimItem() is inefficient with huge data