<i id='Qz2sn'><tr id='Qz2sn'><dt id='Qz2sn'><q id='Qz2sn'><span id='Qz2sn'><b id='Qz2sn'><form id='Qz2sn'><ins id='Qz2sn'></ins><ul id='Qz2sn'></ul><sub id='Qz2sn'></sub></form><legend id='Qz2sn'></legend><bdo id='Qz2sn'><pre id='Qz2sn'><center id='Qz2sn'></center></pre></bdo></b><th id='Qz2sn'></th></span></q></dt></tr></i><div id='Qz2sn'><tfoot id='Qz2sn'></tfoot><dl id='Qz2sn'><fieldset id='Qz2sn'></fieldset></dl></div>
    <bdo id='Qz2sn'></bdo><ul id='Qz2sn'></ul>
<tfoot id='Qz2sn'></tfoot>

  • <legend id='Qz2sn'><style id='Qz2sn'><dir id='Qz2sn'><q id='Qz2sn'></q></dir></style></legend>

      <small id='Qz2sn'></small><noframes id='Qz2sn'>

        在数据库中存储媒体文件的最佳方式是什么?

        What is the best way to store media files on a database?(在数据库中存储媒体文件的最佳方式是什么?)

          <legend id='RkV2M'><style id='RkV2M'><dir id='RkV2M'><q id='RkV2M'></q></dir></style></legend>
          <tfoot id='RkV2M'></tfoot>

          <small id='RkV2M'></small><noframes id='RkV2M'>

                <tbody id='RkV2M'></tbody>
              • <bdo id='RkV2M'></bdo><ul id='RkV2M'></ul>

                  <i id='RkV2M'><tr id='RkV2M'><dt id='RkV2M'><q id='RkV2M'><span id='RkV2M'><b id='RkV2M'><form id='RkV2M'><ins id='RkV2M'></ins><ul id='RkV2M'></ul><sub id='RkV2M'></sub></form><legend id='RkV2M'></legend><bdo id='RkV2M'><pre id='RkV2M'><center id='RkV2M'></center></pre></bdo></b><th id='RkV2M'></th></span></q></dt></tr></i><div id='RkV2M'><tfoot id='RkV2M'></tfoot><dl id='RkV2M'><fieldset id='RkV2M'></fieldset></dl></div>
                  本文介绍了在数据库中存储媒体文件的最佳方式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想在一个数据库中存储大量的声音文件,但我不知道这是否是一个好的做法.我想知道这样做的利弊.

                  I want to store a large number of sound files in a database, but I don't know if it is a good practice. I would like to know the pros and cons of doing it in this way.

                  我也考虑过可以链接"到这些文件,但也许这会带来比解决方案更多的问题.欢迎任何这方面的经验:)

                  I also thought on the possibility to have "links" to those files, but maybe this will carry more problems than solutions. Any experience in this direction will be welcome :)

                  注意:数据库将是 MySQL.

                  Note: The database will be MySQL.

                  推荐答案

                  我所知道的每个存储大量大文件的系统都将它们存储在数据库的外部.您将文件的所有可查询数据(标题、艺术家、长度等)以及文件的部分路径存储在数据库中.当需要检索文件时,您提取文件的路径,在其前面添加一些文件根目录(或 URL),然后将其返回.

                  Every system I know of that stores large numbers of big files stores them externally to the database. You store all of the queryable data for the file (title, artist, length, etc) in the database, along with a partial path to the file. When it's time to retrieve the file, you extract the file's path, prepend some file root (or URL) to it, and return that.

                  因此,您将有一个位置"列,其中包含部分路径,例如a/b/c/1000",然后您将其映射到:"http://myserver/files/a/b/c/1000.mp3"

                  So, you'd have a "location" column, with a partial path in it, like "a/b/c/1000", which you then map to: "http://myserver/files/a/b/c/1000.mp3"

                  确保您有一种简单的方法将媒体数据库指向不同的服务器/目录,以防数据恢复需要.此外,您可能需要一个例程来将数据库与文件存档的内容重新同步.

                  Make sure that you have an easy way to point the media database at a different server/directory, in case you need that for data recovery. Also, you might need a routine that re-syncs the database with the contents of the file archive.

                  此外,如果您要拥有数以千计的媒体文件,请不要将它们全部存储在一个巨大的目录中 - 这是某些文件系统的性能瓶颈.相反,将它们分解为多个平衡的子树.

                  Also, if you're going to have thousands of media files, don't store them all in one giant directory - that's a performance bottleneck on some file systems. Instead,break them up into multiple balanced sub-trees.

                  这篇关于在数据库中存储媒体文件的最佳方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Bogus foreign key constraint fail(虚假外键约束失败)
                  how to get last insert id after insert query in codeigniter active record(如何在codeigniter活动记录中插入查询后获取最后一个插入ID)
                  Force InnoDB to recheck foreign keys on a table/tables?(强制 InnoDB 重新检查表/表上的外键?)
                  How to auto generate migrations with Sequelize CLI from Sequelize models?(如何使用 Sequelize CLI 从 Sequelize 模型自动生成迁移?)
                  Clear MySQL query cache without restarting server(无需重启服务器即可清除 MySQL 查询缓存)
                  ALTER TABLE to add a composite primary key(ALTER TABLE 添加复合主键)

                  <small id='XQ7id'></small><noframes id='XQ7id'>

                        <bdo id='XQ7id'></bdo><ul id='XQ7id'></ul>
                        <tfoot id='XQ7id'></tfoot>

                          <tbody id='XQ7id'></tbody>
                      • <i id='XQ7id'><tr id='XQ7id'><dt id='XQ7id'><q id='XQ7id'><span id='XQ7id'><b id='XQ7id'><form id='XQ7id'><ins id='XQ7id'></ins><ul id='XQ7id'></ul><sub id='XQ7id'></sub></form><legend id='XQ7id'></legend><bdo id='XQ7id'><pre id='XQ7id'><center id='XQ7id'></center></pre></bdo></b><th id='XQ7id'></th></span></q></dt></tr></i><div id='XQ7id'><tfoot id='XQ7id'></tfoot><dl id='XQ7id'><fieldset id='XQ7id'></fieldset></dl></div>
                            <legend id='XQ7id'><style id='XQ7id'><dir id='XQ7id'><q id='XQ7id'></q></dir></style></legend>