dsq30861 2014-08-16 12:19
浏览 60
已采纳

哪个更快:从XML文件或MySQL表中读取数据?

I have an XML file which has 2 pieces of information:

  1. Watch world cup on Youtube
  2. Go for a drink at Bedroom club

Which the order of the tags are: "Watch" and "Go" tags are parent tags, "world cup on" and "for a drink at" are children tags and "Youtube" and "Bedroom club" are children tags of the previous ones.

And I also got a database which has the same information as in that structure:

  • 1st column:act_style(Watch/Go)
  • 2nd column:act_desc (world cup on/for a drink at)
  • 3rd column:act_page (Youtube/Bedroom club)

So my question is which of these pieces of information does PHP get faster or does it get them in the same time?

  • 写回答

1条回答 默认 最新

  • duandi4238 2014-08-16 13:11
    关注

    What I think you meant here is a "relational" data base that can be accessed with SQL. The intent of XML is to store data in a flat file, humanly readable, easily accessible form. Methods for accessing an XML data "store" are quite robust and evolving all the time, to include a proposal from Microsoft for "XQL" - an SQL equivalent designed to manipulate XML data stores.

    In XML data storage, the data is stored in a file which represents an XML Schema of the data. To read the data, you have to pull and open the entire file in memory and use techniques like xpath to get the data element you want. In SQL data storage, the data is stored in a database ( usually relational database). To read the data, you simple sent an SQL query to the database. The database management engine analysis the query and get the required data elements you ask for in your query which is finally sent to you as a reply.

    SQL is flexible and easy to use. Even on the text console only a few lines of code are enough to do complex data base queries.

    I see in this situation SQL would be better.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料