Re:PostgreSQL 8.3 Released
by inklesspen on Monday February 04, 2008 @11:52AM
(#109154)
It doesn't index the XML because it also doesn't provide any comparison methods for XML. Largely because string comparisons on XML tend to be less than useful, I think.
Re:PostgreSQL 8.3 Released
by bayareaguy on Tuesday February 05, 2008 @12:35AM
(#109546)
Although you can't index xml columns directly, you can define functional indexes over them. As long as you are careful to use the same function in your where clauses the index can be used.
Here's an example taken from Nikolay Samokhvalov's XML Support in PostgreSQL paper[1].
CREATE INDEX i_table1_xdata ON table1
USING btree( xpath_array(xdata, '//person/@name') );
[1] - http://www.pgcon.org/2007/schedule/attachments/16-xml_in_pos...I'm not familiar with how they've done it in PostgreSQL, but DB2 does support XML indexes. You just have to write an XPath statement to represent what is stored in the index. Then you can write an XQuery statement and the query engine will use that index. It's quite fast.
But when I look at the XML functions [2], I can start to see where the real value is. In Chron X, we're storing vast sums of XML in SQL as strings, so being able to parse it per-element and pull them could be very helpful.
[1]http://www.postgresql.org/docs/8.3/static/datatype-xml.html
[2]http://www.postgresql.org/docs/8.3/static/functions-xml.html