Closed shouze closed 5 years ago
when the table grows a lot (million of lines), hash is an indexed column while model and identifier are not 😢 .
hash
model
identifier
The sadness resides in this picture:
The happiness resides in this picture ⚡️ 🦄 🎉
So, to implement that, I suggest to change ActionManager::findOrCreateComponent() implementation to use the hash:
ActionManager::findOrCreateComponent()
https://github.com/stephpy/timeline-bundle/blob/e408d9d17a811e74c51ddcb9f03d8aa8fdc5a583/Driver/ORM/ActionManager.php#L77-L98
public function findOrCreateComponent($model, $identifier = null, $flush = true) { $resolvedComponentData = $this->resolveModelAndIdentifier($model, $identifier); $component = $this->getComponentRepository() ->createQueryBuilder('c') ->where('c.hash = :hash') // Imply to add getHash method into https://github.com/stephpy/timeline/blob/d059ba3c2ffbefc2ec6d8ac68c7d6037b890b487/src/ResolveComponent/ValueObject/ResolveComponentModelIdentifier.php ->setParameter('hash', $resolvedComponentData->getHash()) ->getQuery() ->getOneOrNullResult() ; if ($component) { $component->setData($resolvedComponentData->getData()); return $component; } return $this->createComponentFromResolvedComponentData($resolvedComponentData, $flush); }
closed by https://github.com/stephpy/timeline/pull/49 & https://github.com/stephpy/timeline-bundle/pull/213
Pain point
when the table grows a lot (million of lines),
hash
is an indexed column whilemodel
andidentifier
are not 😢 .The sadness resides in this picture:
Change proposal
The happiness resides in this picture ⚡️ 🦄 🎉
So, to implement that, I suggest to change
ActionManager::findOrCreateComponent()
implementation to use the hash:https://github.com/stephpy/timeline-bundle/blob/e408d9d17a811e74c51ddcb9f03d8aa8fdc5a583/Driver/ORM/ActionManager.php#L77-L98