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: 49A85EFD.3010206@dunslane.net (view raw or flat)
Thread:
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 
twenty,twenty),'\n\t',xmlelement(name 
hundred,hundred),'\n\t',xmlelement(name 
thousand,thousand),'\n\t',xmlelement(name 
twothusand,twothousand),'\n\t',xmlelement(name 
fivethous,fivethous),'\n\t',xmlelement(name 
tenthous,tenthous),'\n\t',xmlelement(name 
odd,odd),'\n\t',xmlelement(name even,even),'\n\t',xmlelement(name 
stringu1,stringu1),'\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 ;
 count 
--------
 100000
(1 row)

Time: 27.722 ms


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

cheers

andrew



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

In response to

Responses

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-2014 The PostgreSQL Global Development Group