-
Type: Improvement
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 7.3
-
Component/s: Core MongoDB
-
Tags:
There is a MongoDB query, used on each document creation that is O(n) (n number of document in the repo), it is CPU bound:
2015-08-27T17:40:03.839+0200 I QUERY [conn39] query nuxeo.default query: { ecm:ancestorIds: "3bcbb770-7075-4357-84bb-8fdc6c61b87d" } planSummary: COLLSCAN ntoreturn:0 ntoskip:0 nscanned:0 nscannedObjects:30874 keyUpdates:0 writeConflicts:0 numYields:241 nreturned:0 reslen:20 locks:{ Global: { acquireCount: { r: 484 } }, Database: { acquireCount: { r: 242 } }, Collection: { acquireCount: { r: 242 } } } 101ms
-> add index on ecm:ancestorIds, and a bunch of other standard properties used in queries all the time.
Other queries are slow:
select * from Document where ecm:isProxy = 0 AND ecm:isCheckedInVersion = 1 AND rend:renditionName='thumbnail' AND rend:sourceId='<someid>' order by dc:modified desc
With rend:renditionName = thumbnail / pdf / zipExport / xmlExport, called by RenditionActionBean.hasVisibleRenditions.
-> add index on rend:renditionName.
SELECT ecm:uuid FROM Document WHERE drv:subscriptions/*1/username = 'Administrator' AND drv:subscriptions/*1/enabled = 1 AND ecm:currentLifeCycleState <> 'deleted' ORDER BY dc:title, dc:created DESC
Called by NuxeoDriveActions.canNavigateToCurrentSynchronizationRoot
-> add index on drv:subscriptions.enabled.