[bdbxml] "Pure" XPath2 versus XQuery

"Kiril Stankov" <[email protected]> Wed, 22 Feb 2006 00:14:24 +0200
Newsgroups gmane.comp.db.dbxml.general
Message-ID <[email protected]>
--=__Part90B225D0.0__=
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

Hi all,
=20
I wonder if there is performance difference (or other pros and cons) when =
executing simple queries as XPath or XQuery.
Example:
=20
/Item[@type=3D'Mail' and days-from-duration(fn:current-date()-xs:date(/Item=
/CreationTime)) <=3D 7]
=20
versus
=20
for $x in /Item[@type=3D'Mail']
where days-from-duration(fn:current-date()-xs:date($x/CreationTime)) <=3D =
5
return $x
=20
I examined the query plans and they both seem almost same...
Well, this is a simple example, but should I always prefer XPath, if it =
does the job?
=20
TIA,
=20
Kiril.
=20


--=__Part90B225D0.0__=
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Description: HTML

<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dutf-8">
<META content=3D"MSHTML 6.00.3790.2577" name=3DGENERATOR></HEAD>
<BODY style=3D"MARGIN: 4px 4px 1px; FONT: 10pt Trebuchet MS">
<DIV>Hi all,</DIV>
<DIV>&nbsp;</DIV>
<DIV>I wonder if there is performance&nbsp;difference (or other pros and =
cons) when executing simple queries&nbsp;as XPath or XQuery.</DIV>
<DIV>Example:</DIV>
<DIV>&nbsp;</DIV>
<DIV>/Item[@type=3D'Mail' and days-from-duration(fn:current-date()-xs:date(=
/Item/CreationTime)) &lt;=3D 7]</DIV>
<DIV>&nbsp;</DIV>
<DIV>versus</DIV>
<DIV>&nbsp;</DIV>
<DIV>for $x in /Item[@type=3D'Mail']<BR>where days-from-duration(fn:current=
-date()-xs:date($x/CreationTime)) &lt;=3D 5<BR>return $x</DIV>
<DIV>&nbsp;</DIV>
<DIV>I examined the query plans and they both seem almost same...</DIV>
<DIV>Well, this is a simple example, but should I always prefer XPath, if =
it does the job?</DIV>
<DIV>&nbsp;</DIV>
<DIV>TIA,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Kiril.</DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

--=__Part90B225D0.0__=--