Which is better collection() or root element in cts:search option in MarkLogic
In one of my projects, MarkLogic consultant advised me to use collection()
in cts:search
, and in another project, ML consultants have advised to use root element in cts:search
. In both projects, we had the same volume of documents. Which one is better with respect to performance?
Let's say we have a document (I am taking a small document just to explain the scenario). It has collection named "demo":
<root>
<child1>ABC</child1>
<child2>DEF</child2>
<child3>GHI</child3>
<child4>JKL</child4>
</root>
Which case is better/more efficient:
cts:search(/root, cts:and-query((....some cts:queries..)))
cts:search(collection("demo"), cts:and-query((....some cts:queries..)))
Please help me with an explanation which one is better than other.
xquery marklogic
add a comment |
In one of my projects, MarkLogic consultant advised me to use collection()
in cts:search
, and in another project, ML consultants have advised to use root element in cts:search
. In both projects, we had the same volume of documents. Which one is better with respect to performance?
Let's say we have a document (I am taking a small document just to explain the scenario). It has collection named "demo":
<root>
<child1>ABC</child1>
<child2>DEF</child2>
<child3>GHI</child3>
<child4>JKL</child4>
</root>
Which case is better/more efficient:
cts:search(/root, cts:and-query((....some cts:queries..)))
cts:search(collection("demo"), cts:and-query((....some cts:queries..)))
Please help me with an explanation which one is better than other.
xquery marklogic
add a comment |
In one of my projects, MarkLogic consultant advised me to use collection()
in cts:search
, and in another project, ML consultants have advised to use root element in cts:search
. In both projects, we had the same volume of documents. Which one is better with respect to performance?
Let's say we have a document (I am taking a small document just to explain the scenario). It has collection named "demo":
<root>
<child1>ABC</child1>
<child2>DEF</child2>
<child3>GHI</child3>
<child4>JKL</child4>
</root>
Which case is better/more efficient:
cts:search(/root, cts:and-query((....some cts:queries..)))
cts:search(collection("demo"), cts:and-query((....some cts:queries..)))
Please help me with an explanation which one is better than other.
xquery marklogic
In one of my projects, MarkLogic consultant advised me to use collection()
in cts:search
, and in another project, ML consultants have advised to use root element in cts:search
. In both projects, we had the same volume of documents. Which one is better with respect to performance?
Let's say we have a document (I am taking a small document just to explain the scenario). It has collection named "demo":
<root>
<child1>ABC</child1>
<child2>DEF</child2>
<child3>GHI</child3>
<child4>JKL</child4>
</root>
Which case is better/more efficient:
cts:search(/root, cts:and-query((....some cts:queries..)))
cts:search(collection("demo"), cts:and-query((....some cts:queries..)))
Please help me with an explanation which one is better than other.
xquery marklogic
xquery marklogic
edited Nov 8 at 19:15
Joel
1,5746719
1,5746719
asked Nov 8 at 16:57
Nikunj Vekariya
493317
493317
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
They are both single term lookups, as far as search execution goes, so performance should be the same.
The real distinction is about how you want to manage your content. You can have more than one collection on the same document, so you can slice the same content multiple way, but you can only have one root element. Collections also let you abstract away from the details of document structure: you could have multiple different root elements within the same collection.
in addition, consider that collections are 'invisible' metatdata from the perspective of an xml 'file' -- i.e. if you save the document as an xml file (or read from an xml file) the collection to which it belongs is not part of that file, it must be associated separately similar to uri in that it is in the database representation but not part of the XML content itself. This has pros and cons.
– DALDEI
Nov 10 at 13:56
add a comment |
As per MarkLogic documentation "MarkLogic's implementation of collections is designed to optimize query performance against large volumes of documents.". So, it means you can identify the difference on only huge database.
I tried to identify this by practical, so I created two XQuery, one with collection and one with element as you suggested. But, I put xdmp:query-trace(fn:true())
at the top of both the XQuery. I ran both the query one by one and analysed my MarkLogic log file.
If it is element XQuery:
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: xdmp:eval("declare namespace sem = "http://marklogic.com/semantics&quo...", (), <options xmlns="xdmp:eval"><database>5310618057872024096</database>...</options>)
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Analyzing path for search: fn:collection()/sem:triples
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Step 1 is searchable: fn:collection()
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Step 2 is searchable: sem:triples
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Path is fully searchable.
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Gathering constraints.
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Step 2 contributed 1 constraint: sem:triples
2018-11-12 15:16:58.449 Info: App-Services: at 5:12: Search query contributed 1 constraint: cts:element-value-query(xs:QName("sem:object"), "taxonomy", ("lang=en"), 1)
2018-11-12 15:16:58.449 Info: App-Services: at 5:12: Executing search.
2018-11-12 15:16:58.464 Info: App-Services: at 5:12: Selected 65964 fragments to filter
and if it is collection XQuery:
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: xdmp:eval("declare namespace sem = "http://marklogic.com/semantics&quo...", (), <options xmlns="xdmp:eval"><database>5310618057872024096</database>...</options>)
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Analyzing path for search: fn:collection("/triples")
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Step 1 is searchable: fn:collection("/triples")
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Path is fully searchable.
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Gathering constraints.
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Step 1 contributed 1 constraint: fn:collection("/triples")
2018-11-12 15:20:07.875 Info: App-Services: at 5:11: Search query contributed 1 constraint: cts:element-value-query(xs:QName("sem:object"), "taxonomy", ("lang=en"), 1)
2018-11-12 15:20:07.875 Info: App-Services: at 5:11: Executing search.
2018-11-12 15:20:07.891 Info: App-Services: at 5:11: Selected 65964 fragments to filter
The difference is clearly noticable. If we are using collection query, MarkLogic is doing everthing almost in single step "1" but if it is element query, MarkLogic is doing two step process.
Those traces aren't showing you two different steps; they are showing you the set of constraints being added to a single query. If you looked at the plan (wrap axdmp:plan
around thects:search
) you would see the exact queries the index is resolving. When constraints are intersected (and), the one with the smallest number of hits in each stand will be the determinant of the amount of work, but the resolution is so fast you'll not notice except in very large stands and leaf result sets.
– mholstege
Nov 15 at 15:06
Thanks @mholsteg
– Navin Rawat
Nov 16 at 6:03
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53212602%2fwhich-is-better-collection-or-root-element-in-ctssearch-option-in-marklogic%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
They are both single term lookups, as far as search execution goes, so performance should be the same.
The real distinction is about how you want to manage your content. You can have more than one collection on the same document, so you can slice the same content multiple way, but you can only have one root element. Collections also let you abstract away from the details of document structure: you could have multiple different root elements within the same collection.
in addition, consider that collections are 'invisible' metatdata from the perspective of an xml 'file' -- i.e. if you save the document as an xml file (or read from an xml file) the collection to which it belongs is not part of that file, it must be associated separately similar to uri in that it is in the database representation but not part of the XML content itself. This has pros and cons.
– DALDEI
Nov 10 at 13:56
add a comment |
They are both single term lookups, as far as search execution goes, so performance should be the same.
The real distinction is about how you want to manage your content. You can have more than one collection on the same document, so you can slice the same content multiple way, but you can only have one root element. Collections also let you abstract away from the details of document structure: you could have multiple different root elements within the same collection.
in addition, consider that collections are 'invisible' metatdata from the perspective of an xml 'file' -- i.e. if you save the document as an xml file (or read from an xml file) the collection to which it belongs is not part of that file, it must be associated separately similar to uri in that it is in the database representation but not part of the XML content itself. This has pros and cons.
– DALDEI
Nov 10 at 13:56
add a comment |
They are both single term lookups, as far as search execution goes, so performance should be the same.
The real distinction is about how you want to manage your content. You can have more than one collection on the same document, so you can slice the same content multiple way, but you can only have one root element. Collections also let you abstract away from the details of document structure: you could have multiple different root elements within the same collection.
They are both single term lookups, as far as search execution goes, so performance should be the same.
The real distinction is about how you want to manage your content. You can have more than one collection on the same document, so you can slice the same content multiple way, but you can only have one root element. Collections also let you abstract away from the details of document structure: you could have multiple different root elements within the same collection.
answered Nov 8 at 18:17
mholstege
3,45274
3,45274
in addition, consider that collections are 'invisible' metatdata from the perspective of an xml 'file' -- i.e. if you save the document as an xml file (or read from an xml file) the collection to which it belongs is not part of that file, it must be associated separately similar to uri in that it is in the database representation but not part of the XML content itself. This has pros and cons.
– DALDEI
Nov 10 at 13:56
add a comment |
in addition, consider that collections are 'invisible' metatdata from the perspective of an xml 'file' -- i.e. if you save the document as an xml file (or read from an xml file) the collection to which it belongs is not part of that file, it must be associated separately similar to uri in that it is in the database representation but not part of the XML content itself. This has pros and cons.
– DALDEI
Nov 10 at 13:56
in addition, consider that collections are 'invisible' metatdata from the perspective of an xml 'file' -- i.e. if you save the document as an xml file (or read from an xml file) the collection to which it belongs is not part of that file, it must be associated separately similar to uri in that it is in the database representation but not part of the XML content itself. This has pros and cons.
– DALDEI
Nov 10 at 13:56
in addition, consider that collections are 'invisible' metatdata from the perspective of an xml 'file' -- i.e. if you save the document as an xml file (or read from an xml file) the collection to which it belongs is not part of that file, it must be associated separately similar to uri in that it is in the database representation but not part of the XML content itself. This has pros and cons.
– DALDEI
Nov 10 at 13:56
add a comment |
As per MarkLogic documentation "MarkLogic's implementation of collections is designed to optimize query performance against large volumes of documents.". So, it means you can identify the difference on only huge database.
I tried to identify this by practical, so I created two XQuery, one with collection and one with element as you suggested. But, I put xdmp:query-trace(fn:true())
at the top of both the XQuery. I ran both the query one by one and analysed my MarkLogic log file.
If it is element XQuery:
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: xdmp:eval("declare namespace sem = "http://marklogic.com/semantics&quo...", (), <options xmlns="xdmp:eval"><database>5310618057872024096</database>...</options>)
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Analyzing path for search: fn:collection()/sem:triples
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Step 1 is searchable: fn:collection()
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Step 2 is searchable: sem:triples
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Path is fully searchable.
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Gathering constraints.
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Step 2 contributed 1 constraint: sem:triples
2018-11-12 15:16:58.449 Info: App-Services: at 5:12: Search query contributed 1 constraint: cts:element-value-query(xs:QName("sem:object"), "taxonomy", ("lang=en"), 1)
2018-11-12 15:16:58.449 Info: App-Services: at 5:12: Executing search.
2018-11-12 15:16:58.464 Info: App-Services: at 5:12: Selected 65964 fragments to filter
and if it is collection XQuery:
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: xdmp:eval("declare namespace sem = "http://marklogic.com/semantics&quo...", (), <options xmlns="xdmp:eval"><database>5310618057872024096</database>...</options>)
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Analyzing path for search: fn:collection("/triples")
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Step 1 is searchable: fn:collection("/triples")
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Path is fully searchable.
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Gathering constraints.
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Step 1 contributed 1 constraint: fn:collection("/triples")
2018-11-12 15:20:07.875 Info: App-Services: at 5:11: Search query contributed 1 constraint: cts:element-value-query(xs:QName("sem:object"), "taxonomy", ("lang=en"), 1)
2018-11-12 15:20:07.875 Info: App-Services: at 5:11: Executing search.
2018-11-12 15:20:07.891 Info: App-Services: at 5:11: Selected 65964 fragments to filter
The difference is clearly noticable. If we are using collection query, MarkLogic is doing everthing almost in single step "1" but if it is element query, MarkLogic is doing two step process.
Those traces aren't showing you two different steps; they are showing you the set of constraints being added to a single query. If you looked at the plan (wrap axdmp:plan
around thects:search
) you would see the exact queries the index is resolving. When constraints are intersected (and), the one with the smallest number of hits in each stand will be the determinant of the amount of work, but the resolution is so fast you'll not notice except in very large stands and leaf result sets.
– mholstege
Nov 15 at 15:06
Thanks @mholsteg
– Navin Rawat
Nov 16 at 6:03
add a comment |
As per MarkLogic documentation "MarkLogic's implementation of collections is designed to optimize query performance against large volumes of documents.". So, it means you can identify the difference on only huge database.
I tried to identify this by practical, so I created two XQuery, one with collection and one with element as you suggested. But, I put xdmp:query-trace(fn:true())
at the top of both the XQuery. I ran both the query one by one and analysed my MarkLogic log file.
If it is element XQuery:
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: xdmp:eval("declare namespace sem = "http://marklogic.com/semantics&quo...", (), <options xmlns="xdmp:eval"><database>5310618057872024096</database>...</options>)
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Analyzing path for search: fn:collection()/sem:triples
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Step 1 is searchable: fn:collection()
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Step 2 is searchable: sem:triples
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Path is fully searchable.
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Gathering constraints.
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Step 2 contributed 1 constraint: sem:triples
2018-11-12 15:16:58.449 Info: App-Services: at 5:12: Search query contributed 1 constraint: cts:element-value-query(xs:QName("sem:object"), "taxonomy", ("lang=en"), 1)
2018-11-12 15:16:58.449 Info: App-Services: at 5:12: Executing search.
2018-11-12 15:16:58.464 Info: App-Services: at 5:12: Selected 65964 fragments to filter
and if it is collection XQuery:
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: xdmp:eval("declare namespace sem = "http://marklogic.com/semantics&quo...", (), <options xmlns="xdmp:eval"><database>5310618057872024096</database>...</options>)
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Analyzing path for search: fn:collection("/triples")
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Step 1 is searchable: fn:collection("/triples")
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Path is fully searchable.
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Gathering constraints.
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Step 1 contributed 1 constraint: fn:collection("/triples")
2018-11-12 15:20:07.875 Info: App-Services: at 5:11: Search query contributed 1 constraint: cts:element-value-query(xs:QName("sem:object"), "taxonomy", ("lang=en"), 1)
2018-11-12 15:20:07.875 Info: App-Services: at 5:11: Executing search.
2018-11-12 15:20:07.891 Info: App-Services: at 5:11: Selected 65964 fragments to filter
The difference is clearly noticable. If we are using collection query, MarkLogic is doing everthing almost in single step "1" but if it is element query, MarkLogic is doing two step process.
Those traces aren't showing you two different steps; they are showing you the set of constraints being added to a single query. If you looked at the plan (wrap axdmp:plan
around thects:search
) you would see the exact queries the index is resolving. When constraints are intersected (and), the one with the smallest number of hits in each stand will be the determinant of the amount of work, but the resolution is so fast you'll not notice except in very large stands and leaf result sets.
– mholstege
Nov 15 at 15:06
Thanks @mholsteg
– Navin Rawat
Nov 16 at 6:03
add a comment |
As per MarkLogic documentation "MarkLogic's implementation of collections is designed to optimize query performance against large volumes of documents.". So, it means you can identify the difference on only huge database.
I tried to identify this by practical, so I created two XQuery, one with collection and one with element as you suggested. But, I put xdmp:query-trace(fn:true())
at the top of both the XQuery. I ran both the query one by one and analysed my MarkLogic log file.
If it is element XQuery:
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: xdmp:eval("declare namespace sem = "http://marklogic.com/semantics&quo...", (), <options xmlns="xdmp:eval"><database>5310618057872024096</database>...</options>)
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Analyzing path for search: fn:collection()/sem:triples
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Step 1 is searchable: fn:collection()
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Step 2 is searchable: sem:triples
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Path is fully searchable.
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Gathering constraints.
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Step 2 contributed 1 constraint: sem:triples
2018-11-12 15:16:58.449 Info: App-Services: at 5:12: Search query contributed 1 constraint: cts:element-value-query(xs:QName("sem:object"), "taxonomy", ("lang=en"), 1)
2018-11-12 15:16:58.449 Info: App-Services: at 5:12: Executing search.
2018-11-12 15:16:58.464 Info: App-Services: at 5:12: Selected 65964 fragments to filter
and if it is collection XQuery:
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: xdmp:eval("declare namespace sem = "http://marklogic.com/semantics&quo...", (), <options xmlns="xdmp:eval"><database>5310618057872024096</database>...</options>)
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Analyzing path for search: fn:collection("/triples")
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Step 1 is searchable: fn:collection("/triples")
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Path is fully searchable.
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Gathering constraints.
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Step 1 contributed 1 constraint: fn:collection("/triples")
2018-11-12 15:20:07.875 Info: App-Services: at 5:11: Search query contributed 1 constraint: cts:element-value-query(xs:QName("sem:object"), "taxonomy", ("lang=en"), 1)
2018-11-12 15:20:07.875 Info: App-Services: at 5:11: Executing search.
2018-11-12 15:20:07.891 Info: App-Services: at 5:11: Selected 65964 fragments to filter
The difference is clearly noticable. If we are using collection query, MarkLogic is doing everthing almost in single step "1" but if it is element query, MarkLogic is doing two step process.
As per MarkLogic documentation "MarkLogic's implementation of collections is designed to optimize query performance against large volumes of documents.". So, it means you can identify the difference on only huge database.
I tried to identify this by practical, so I created two XQuery, one with collection and one with element as you suggested. But, I put xdmp:query-trace(fn:true())
at the top of both the XQuery. I ran both the query one by one and analysed my MarkLogic log file.
If it is element XQuery:
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: xdmp:eval("declare namespace sem = "http://marklogic.com/semantics&quo...", (), <options xmlns="xdmp:eval"><database>5310618057872024096</database>...</options>)
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Analyzing path for search: fn:collection()/sem:triples
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Step 1 is searchable: fn:collection()
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Step 2 is searchable: sem:triples
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Path is fully searchable.
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Gathering constraints.
2018-11-12 15:16:58.448 Info: App-Services: at 5:12: Step 2 contributed 1 constraint: sem:triples
2018-11-12 15:16:58.449 Info: App-Services: at 5:12: Search query contributed 1 constraint: cts:element-value-query(xs:QName("sem:object"), "taxonomy", ("lang=en"), 1)
2018-11-12 15:16:58.449 Info: App-Services: at 5:12: Executing search.
2018-11-12 15:16:58.464 Info: App-Services: at 5:12: Selected 65964 fragments to filter
and if it is collection XQuery:
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: xdmp:eval("declare namespace sem = "http://marklogic.com/semantics&quo...", (), <options xmlns="xdmp:eval"><database>5310618057872024096</database>...</options>)
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Analyzing path for search: fn:collection("/triples")
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Step 1 is searchable: fn:collection("/triples")
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Path is fully searchable.
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Gathering constraints.
2018-11-12 15:20:07.871 Info: App-Services: at 5:11: Step 1 contributed 1 constraint: fn:collection("/triples")
2018-11-12 15:20:07.875 Info: App-Services: at 5:11: Search query contributed 1 constraint: cts:element-value-query(xs:QName("sem:object"), "taxonomy", ("lang=en"), 1)
2018-11-12 15:20:07.875 Info: App-Services: at 5:11: Executing search.
2018-11-12 15:20:07.891 Info: App-Services: at 5:11: Selected 65964 fragments to filter
The difference is clearly noticable. If we are using collection query, MarkLogic is doing everthing almost in single step "1" but if it is element query, MarkLogic is doing two step process.
answered Nov 12 at 10:10
Navin Rawat
2,75111427
2,75111427
Those traces aren't showing you two different steps; they are showing you the set of constraints being added to a single query. If you looked at the plan (wrap axdmp:plan
around thects:search
) you would see the exact queries the index is resolving. When constraints are intersected (and), the one with the smallest number of hits in each stand will be the determinant of the amount of work, but the resolution is so fast you'll not notice except in very large stands and leaf result sets.
– mholstege
Nov 15 at 15:06
Thanks @mholsteg
– Navin Rawat
Nov 16 at 6:03
add a comment |
Those traces aren't showing you two different steps; they are showing you the set of constraints being added to a single query. If you looked at the plan (wrap axdmp:plan
around thects:search
) you would see the exact queries the index is resolving. When constraints are intersected (and), the one with the smallest number of hits in each stand will be the determinant of the amount of work, but the resolution is so fast you'll not notice except in very large stands and leaf result sets.
– mholstege
Nov 15 at 15:06
Thanks @mholsteg
– Navin Rawat
Nov 16 at 6:03
Those traces aren't showing you two different steps; they are showing you the set of constraints being added to a single query. If you looked at the plan (wrap a
xdmp:plan
around the cts:search
) you would see the exact queries the index is resolving. When constraints are intersected (and), the one with the smallest number of hits in each stand will be the determinant of the amount of work, but the resolution is so fast you'll not notice except in very large stands and leaf result sets.– mholstege
Nov 15 at 15:06
Those traces aren't showing you two different steps; they are showing you the set of constraints being added to a single query. If you looked at the plan (wrap a
xdmp:plan
around the cts:search
) you would see the exact queries the index is resolving. When constraints are intersected (and), the one with the smallest number of hits in each stand will be the determinant of the amount of work, but the resolution is so fast you'll not notice except in very large stands and leaf result sets.– mholstege
Nov 15 at 15:06
Thanks @mholsteg
– Navin Rawat
Nov 16 at 6:03
Thanks @mholsteg
– Navin Rawat
Nov 16 at 6:03
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53212602%2fwhich-is-better-collection-or-root-element-in-ctssearch-option-in-marklogic%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown