[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Efficient XPath 2.0 expression to return each <row

Subject: Re: Efficient XPath 2.0 expression to return each <row> element for which there are other <row> elements having the same navaid?
From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 13 Dec 2018 19:54:24 -0000
Re:  Efficient XPath 2.0 expression to return each <row
On Thu, 2018-12-13 at 18:51 +0000, Martin Honnen martin.honnen@xxxxxx
wrote:
> On 13.12.2018 19:40, Eliot Kimber ekimber@xxxxxxxxxxxx wrote:
> > If this is a real task support effort and not just a learning
> > exercise and you're using Oxygen then I would follow Graydon's lead
> > and use XQuery 3 to build a map that can then give you a quick
> > answer.
> 
> If you move from XPath 2 to XQuery 3 you can as well solve it with
> grouping

Yes, and that's likely to use the element value index if there is one.

Note also that Roger's original solution,
//row[navaid = (preceding-sibling::row/navaid, following-sibling::row/navaid)]
might not be as slow is it appears in an XQuery system with an element
value index. Depending on the database,
    //row[ count(//row/navaid = navaid) gt 1) ]
might be even more likely to trigger an efficient use of the index (i
didn't check, though), and is closer to the way the original problem
was stated.

Performance in an interpreted language is very often a case of doing
measurements and considering the trade-off between speed and
maintainability. However, it's easy to write O(NB2) expressions (or
worse) that run fine for a small test suite and bog down unacceptably
in production.

Liam


-- 
Liam Quin, https://www.holoweb.net/liam/
Available for XML/Document/Information Architecture/
XSL/XQuery/Web/Text Processing/A11Y consulting & training.
Web slave for vintage clipart http://www.fromoldbooks.org/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.