来自微软的官方文档: In SQL Server, BLOBs can be standard varbinary(max) data that stores the data in tables, or FILESTREAM varbinary(max) objects that store the data in the file system. The size and use of the data determines whether you should use database storage or file system storage. If the following conditions are true, you should consider using FILESTREAM:Objects that are being stored are, on average, larger than 1 MB.Fast read access is important.You are developing applications that use a middle tier for application logic.For smaller objects, storing varbinary(max) BLOBs in the database often provides better streaming performance. 针对你说的碎片问题其实可以用指定FILLFACTOR,因为这些数据不会频繁的被更改所以加索引也不会有太大的影响,而且通过Rebuild index可以解决你说的碎片问题(当然内部碎片可能会有),这个无法避免,但是影响不会太大。而且这个查询是以时间为条件的,所以可以针对时间做分区,这样查询性能是完全可以保证的。
In SQL Server, BLOBs can be standard varbinary(max) data that stores the data in tables, or FILESTREAM varbinary(max) objects that store the data in the file system. The size and use of the data determines whether you should use database storage or file system storage. If the following conditions are true, you should consider using FILESTREAM:Objects that are being stored are, on average, larger than 1 MB.Fast read access is important.You are developing applications that use a middle tier for application logic.For smaller objects, storing varbinary(max) BLOBs in the database often provides better streaming performance.
针对你说的碎片问题其实可以用指定FILLFACTOR,因为这些数据不会频繁的被更改所以加索引也不会有太大的影响,而且通过Rebuild index可以解决你说的碎片问题(当然内部碎片可能会有),这个无法避免,但是影响不会太大。而且这个查询是以时间为条件的,所以可以针对时间做分区,这样查询性能是完全可以保证的。
都放在一张表中的话,会不会导致表中记录快速增长?查询效率会不会受到影响?另外,表记录数有没有限制?
如果把内容都存进数据库,并且按你说法是大量日志,那么数据量会暴增,随着表、索引的增……因为是IDENTITY作为主键,不明白为什么页的分裂次数会快很多?据我了解分页是因为更新导致原有的页无法容纳数据,所以才会产生分页。而这个Log只是增加,不会频繁的更新,所以不太会有你说的这种现象。 使用Filestream一般是针对1M以上的文件使用的。
如果你每条日志记录都用Filestream放到磁盘,你考虑过文件太多导致的性能问题吗? 如果OS上面一个文件夹下有10000W个文件,你要多久才可以打开这个目录?