设计一个表来存储 EXIF 数据
我希望通过查询包含 EXIF 数据的表获得最佳性能。相关查询将仅在 EXIF 数据中搜索指定字符串并返回匹配的行索引。
话虽如此,将 EXIF 数据存储在每个标签具有单独列的表中是否会更好,或者将所有标签存储在单个列中作为一个长分隔字符串也适合我?
我将存储大约 115 个 EXIF 标签,如果连接成单个字符串,每条记录的长度约为 1500 到 2000 个字符。
I'm looking to get the best performance out of querying a table containing EXIF data. The queries in question will only search the EXIF data for the specified strings and return the row index on a match.
With that said, would it better to store the EXIF data in a table with separate columns for each of the tags, or would storing all of the tags in a single column as one long delimited string suit me just as well?
There are around 115 EXIF tags I'll be storing, and each record would be around 1500 to 2000 chars in length if concatenated into a single string.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果将它们全部存储在一列中,您将无法从索引中获得性能优势。您还将违反数据库设计的基本规则,这会产生其自身的后果(每一列应该只存储一条数据)。
我可能会使用与此类似的结构:
EXIF_Tags 表将包含所有有效标签,而 Images 表将保存图像。然后,您可以在
exif_tag_id
列上建立索引,也可以在exif_value
列上建立索引,以便快速搜索。If you store them all in one column you're not going to be able to get performance benefits from indexes. You'll also be violating a cardinal rule of database design, which has its own consequences (each column should only store one piece of data).
I would probably use a structure similar to this:
The EXIF_Tags table would have all of the valid tags and the Images table would hold the images. You can then have indexes on the
exif_tag_id
column and possibly theexif_value
column for quick searching.