Best way to store XML data in a MySQL database, with some specific requirements

后端 未结 4 935
孤独总比滥情好
孤独总比滥情好 2021-02-13 15:44

I am receiving XML data from a service. The test data I am receiving back has about 300 XML nodes, clearly far too many to create individual rows for in a MySQL database.

<
4条回答
  •  没有蜡笔的小新
    2021-02-13 16:20

    You could create a blob column (i.e. mediumtext column). Instead of inserting XML purely as strings in the DB, you could zip the XML, then store in MySQL.

    When you read from MySQL, you unzip it again. Since XML is text you'll get very high compression rates (close to 80% compression). The thought process being, disk IO takes a lot longer time than compression/un-compression which is predominantly Processor bound.

    The downside being you will no longer be able to query or do full text search using SQL....

提交回复
热议问题