Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Large amount of DB calls while running elgg_get_plugins (Trac #4313) #4313
Original ticket http://trac.elgg.org/ticket/4313 on 42055845-06-25 by trac user srokap, assigned to unknown.
Elgg version: 1.8 Beta
I've noticed that while starting Elgg 1.8 core, there are around 2*#plugins calls to DB being made. The calls are made while instantiating data rows to ElggPlugin objects.
I understand why the mechanism works like that, but it obviously seems like a thing that should be optimized. Why not to reuse data already downloaded in elgg_get_entities instead of calling
for every plugin.
Than for every plugin we download ELggObject fields:
Question is, why don't we reuse already downloaded data from first call, and why don't we rebuild instantiating process (entity_row_to_elggstar and constructing ElggObject) to support downloading additional data in single query.
To sum up, we could be making two DB calls to get all of the data much more efficient instead of making over 100 queries (I don't think it's likely to have non-trivial elgg service with less than 50 plugins in practice). It's especially important for ElggPlugin, but could be extended to more general mechanism.
trac user srokap wrote on 42056081-09-08
Just a thought, I've removed first king of calls by allowing ElggEntity->load function to process db row optionally to guid as parameter, and changing ElggObject constructor call. I also thought of something like passing second argument to get_data callback, to pass there some additional row info that could be used by the callback, and passed somehow to the constructor maybe? I'm not sure if it would be helpful if some more sophisticated mechanism is under development.
Are there some particular ticket's You're referring to?