简体   繁体   English

在SQL Server中保存大型请求和响应xml的最佳实践是什么

[英]What is best practice to save large request and response xml in SQL Server

I want to save all XML requests and responses in a SQL Server database. 我想将所有XML请求和响应保存在SQL Server数据库中。 These can be in millions. 这些可能以百万计。 If I use XML type in SQL Server it has performance issue. 如果我在SQL Server中使用XML类型,则会出现性能问题。

Can anyone tell me what will be best approach to save such data? 谁能告诉我什么是保存此类数据的最佳方法?

Thanks 谢谢

I started to write a comment but there was too much for that :) 我开始写评论,但是太多了:)

The right solution may vary, based on what you actually need to do with that data afterwards: 正确的解决方案可能会有所不同,具体取决于之后实际需要处理的数据:

  • If you need just to store some data in logging purpose you can use simple table with column with XML datatype and some ID, datetime stamps, and maybe some XML based index. 如果您需要出于日志目的存储一些数据,则可以使用带有XML数据类型的列和ID,日期时间戳以及一些基于XML的索引的简单表。

  • If you need to build some reports based on this data or have an instant fast access to it - the better way is to parse/aggregate all this XML input and store it in proper build database (tables/indexed etc). 如果您需要基于此数据构建一些报表或可以快速访问它们-更好的方法是解析/汇总所有XML输入并将其存储在适当的构建数据库(表/索引等)中。

  • If this requests and responsive have a massive nature and this XML has no specified structure - consider using some NoSQL solutions. 如果此请求和响应具有大量性质,并且该XML 没有指定的结构 ,请考虑使用一些NoSQL解决方案。

Fe we have a search service with logs that are stored: 如果我们有一个搜索服务,其中存储了以下日志:

  1. search requests as text, 以文字搜索请求,
  2. response in xml, 以xml回应,
  3. also userid, datetime of request start and end. 也是userid,请求开始和结束的日期时间。

We got ~500 searches a day, so we store that in one table with index on userid/datetime. 每天大约有500次搜索,因此我们将其存储在一个表中,并在userid / datetime上进行索引。 All works fine. 一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 分页大型数据集 - SQL Server(最佳实践) - Paging Large Datasets - SQL Server (Best Practice) 将 XML 数据保存到 SQL 服务器的最佳方法是什么? - What is the best way to save XML data to SQL Server? 使用收缩 SQL Server 的最佳做法是什么? - What is best practice to use shrink SQL Server? 在SQL Server中汇总数据的最佳做法是什么? - What is the best practice for aggregating data in SQL Server? SQL Server-规避大型IN(…)子句(> 40000个项目)的最佳实践 - SQL Server - Best practice to circumvent large IN (…) clause (>40000 items) 将这个非常大的 xml 文件导入 SQL 服务器数据库的最佳方法是什么 - What is the best way to import this very large xml file into a SQL Server database 在 AWS RDS SQL 服务器中回滚 SQL 脚本的最佳实践是什么? - What is the best practice to rollback a SQL script in AWS RDS SQL Server? 在SQL中保存大型每月数据备份的最佳方法是什么? - What's the best way to save large monthly data backups in SQL? 使用 Nodejs 将大数据保存到 SQL 服务器的最佳方法 - Best way to save large data to SQL server using Nodejs SQL Server 2005 存储过程中 FTP 的最佳实践是什么? - What is best practice for FTP from a SQL Server 2005 stored procedure?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM