Why would I ever choose to store and manipulate XML in a relational database?

后端 未结 11 2106
谎友^
谎友^ 2020-12-08 03:38

Modern RDBMS\'s have support for XML column types and functionality for dealing with XML in stored procedures. Historically I would always have mapped hierarchical data (whe

11条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-08 04:08

    For example, you get XML documents from some other system, with very rich or complex structure that you want to store; but you only need a few well-defined queries to retrieve that data. In that case, just parse the data you need to generate some indexes, and store the whole XML structure in a single field.

    To do that you don't need much XML-specific support on the DB engine, but it still helps to keep queries expressive.

    Besides that, I'd guess some DMBS with good XML support could let you simply store the XML document, maybe without specifying how to index it. You just use XQuery and hope it somehow optimises to your needs.

提交回复
热议问题