Yeah - I didn't know max would get optimized as well.

I've seen an index not get created (fails somewhat mysteriously) because the data did not conform to the type restriction. If this is what happens you see some kind of message in the ML error log file attesting to this.

good luck

Patrick Force wrote:
Thanks Mike. Attempted the query you suggested and some variations but it didn't improve performance. I think I need to continue along the path to get the index set up correctly. The problem, I believe, has something to do in the index setting. It appears that I've set it up correctly (even sent a screenshot to Ajay to confirm), but my query continues to return an error that suggests that the attribute index doesn't exist. Ajay recommended that I contact support in order to assess any issues that might exist with the install/software etc. I'd obviously like to figure it out before going that route, but it might be necessary.

Danny, I do have the reindexer enabled. We did not reload data after setting the attribute index. We are currently using version 3.1-3.1. I didn't even realize that we don't have the most current version running. Is there a known attribute index bug that was fixed between 3.1-3.1 and 3.1-4? Also, we currently have about 30,000 documents in the directory in question, and that is a bulk of the data in the system as of now. Overall we have a database of 38,061 documents at 1,616 MB.

Thank you all for the quick responses, and let me know about the above or if you have any other feedback for me. I will keep you updated otherwise on the progress.

Patrick

Have you tried:
(for $i in /RootElement
        order by xs:int($i/@index) descending)[ 1 ]/@index
?

If you aren't using namespaces at all (sounds like) just leave those fields blank.

If you get the index set up that query should be OK - we solved exactly this problem yesterday in this way.

Of course it'd be nice if the database had a sequence construct or an autoincrement property like every SQL database in the universe, but it's not impossible to make one yourself given a range index and transactions.

-Mike

Patrick Force wrote:
> I'm attempting to find some alternatives in MarkLogic for improving > the speed of a max XQuery call we currently have in place. I believe > the solution exists, for my case, in setting an attribute index, but > I've been unsuccessful in my attempts so far. The help docs for the > administration interface don't seem to explain the meaning and exact > use of the namespace uri values of a range index. I believe I might > be mixing XPath concepts into the namespace values erroneously. A > more detailed explanation of the scenario:
>
> 1) We have multiple documents that exist at the uri like: > /c/database/documents > 2) Each document contains a root element like: <RootElement > id="HPX_9876" index="9876">...etc.
> 3) Our current XQuery call in question: max(/RootElement/@index)
> 4) I've attempted to set up an attribute index via the administration > console:
>     a) scalar type: string
> b) parent namespace uri: ??? I've attempted a uri-type value like > /c/database/documents/RootElement but I haven't found a good > explanation of what this value should be
>     c) parent localname: RootElement
> d) namespace uri: ??? again, not sure how to set this one but have > tried uri-type value of /c/database/documents/RootElement/@index
>     e) localname: index
> 5) Set the above attribute index in efforts to make the following > XQuery perform a faster max call: > max(for $i in > cts:element-attribute-values(xs:QName(“InsurancePolicy”),xs:QName(“id”))
>         return xs:int($i))
>
> Any ideas/suggestions would be greatly appreciated.
>
> Patrick_______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general

------------------------------------------------------------------------

_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to