Skip site navigation (1) Skip section navigation (2)

Re: xpath processing brain dead

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Nikolay Samokhvalov <samokhvalov(at)gmail(dot)com>
Subject: Re: xpath processing brain dead
Date: 2009-02-27 21:45:33
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers

Andrew Dunstan wrote:
> Tom Lane wrote:
>> Hmm, does this proposal require adding a test of well-formed-ness to
>> a code path that doesn't currently have one?  If so, is that likely
>> to contribute any noticeable slowdown?
>> I can't offhand see an objection to this other than possible performance
>> impact.
> Yeah, testing the well-formedness might cost a bit. We could 
> short-circuit the test by applying some comparatively fast heuristic 
> tests.
> Or we could decide that we'll just fix the xpath prefix part for 8.3 
> and keep the wrapping. I don't want to spend a huge effort on fixing 
> something I regard as fundamentally broken.
> I'll do some tests to see what the cost of extra xml parsing might be.

The extra cost appears to be fairly negligible.

regression=# create table xpathtest3 as select xmlconcat(xmlelement(name 
unique1, unique1), '\n\t',xmlelement(name unique2, unique2), 
'\n\t',xmlelement(name two, two), '\n\t',xmlelement(name four, 
four),'\n\t',xmlelement(name ten,ten),'\n\t',xmlelement(name 
odd,odd),'\n\t',xmlelement(name even,even),'\n\t',xmlelement(name 
stringu2,stringu2),'\n\t',xmlelement(name string4,string4),'\n') from tenk1;

regression=# select count(*) from (select 
xpath('//two[text()="0"]/text()',xmlconcat) as elems from xpathtest3, 
generate_series(1,10) ) x ;
(1 row)

Time: 27.722 ms

Proposed patch for 8.3 attached. (Note: it only reparses in the 
non-document case)



Attachment: xpath.patch
Description: text/x-patch (4.1 KB)

In response to


pgsql-hackers by date

Next:From: Jaime CasanovaDate: 2009-02-27 21:53:51
Subject: Re: Updates of SE-PostgreSQL 8.4devel patches (r1530)
Previous:From: Andrew DunstanDate: 2009-02-27 21:37:15
Subject: Re: xpath processing brain dead

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group