Bug #28834 | Frq: New "type" of indexes on XML documents is needed | ||
---|---|---|---|
Submitted: | 1 Jun 2007 12:27 | Modified: | 1 Jun 2007 12:27 |
Reporter: | Valeriy Kravchuk | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: XML functions | Severity: | S4 (Feature request) |
Version: | 5.1.x | OS: | Any |
Assigned to: | Assigned Account | CPU Architecture: | Any |
[1 Jun 2007 12:27]
Valeriy Kravchuk
[4 Jun 2007 8:10]
Hans-Henrik Stærfeldt
Perhaps what is also needed is a way of treating the xml fields as tables/columns. F.inst. XML: <entry> <name type=1>Foo</name> <name type=2>Bar</name> <name type=3>Baz</name> <values> <property id=1 value=A/> <property id=2 value=B/> <property id=3 value=C/> <property id=4 value=D/> </values> </entry> <entry> <name type=1>Foo</name> <name type=2>Bar</name> <name type=3>Baz</name> <values> <property id=4 value=A/> <property id=5 value=B/> <property id=6 value=C/> <property id=7 value=D/> </values> </entry> SELECT mydata.date, v.'value',n FROM mydata.XML.'/entry/name' n, mydata.XML.'/entry/value' v, WHERE n.'type'=v.'id' AND n.'parent::/parent::'=n.'parent::/parent::/parent::' (Notice 'n' is both a table and a column, as it has both content and attributes. Also notice that you could then check for the the XML being the same, although, here a nifty 'root::' extension might also be valuable. Also notice that selected XML elements may be accessed to get their context (attributes parent etc. I also use a shorthand instead of 'extractValue' (an xpath string after the element) Im unsure, but perhaps an XSD could be given in the table declaration (somehow?), so that the parsing and indexing of the XML fields becomes more effective (not always as strings), and any update could be tested against the XSD.
[23 Oct 2014 11:28]
Daniël van Eeden
The computed virtual columns WL#411 could help here. It is in the 5.7 labs release as presented during OOW 2014. It is also known as 'generated columns' https://oracleus.activeevents.com/2014/connect/sessionDetail.ww?SESSION_ID=2314 (contains a link to the slides) http://mysqlserverteam.com/generated-columns-in-mysql-5-7-5/