java - SQL Server 大量Update和Insert操作如何提升性能?
阿神
阿神 2017-04-17 16:26:12
0
2
487
阿神
阿神

闭关修行中......

reply all(2)
洪涛
  1. Write the logic directly to SqlServer.
    SqlServer supports complex statements, that is, item_id, this_value, time_now can be used as parameters of a stored procedure. Write select if update insert and the like of item_id, this_value, time_now可以当作一个存储过程的参数. 里面写select if update insert之类的

  2. 在逻辑层解决这个问题
    服务启动的时候, 把所有的item_id => (pre_time, cur_time, value)

Solve this problem at the logic layer🎜 When the service starts, load all item_id => (pre_time, cur_time, value) and then cache them. When processing new messages , you will know whether to update or insert. In the end, you only need to process one SQL statement. It is easy to process 1000+ SQL statements per second, just use a few Connections.🎜🎜 🎜
Peter_Zhu

Batch processing, don’t access the database every time there is a piece of data, perform a database access operation every 100 pieces

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!