時間:2024-03-10 11:43作者:下載吧人氣:27
需求
現(xiàn)在有一個需求是將10w條數(shù)據(jù)插入到MSSQL數(shù)據(jù)庫中,表結(jié)構(gòu)如下,你會怎么做,你感覺插入10W條數(shù)據(jù)插入到MSSQL如下的表中需要多久呢?
或者你的批量數(shù)據(jù)是如何插入的呢?我今天就此問題做個探討。
壓測mvc的http接口看下數(shù)據(jù)
首先說下這里只是做個參照,來理解插入數(shù)據(jù)庫的性能狀況,與開篇的需求無半毛錢關(guān)系。
mvc接口代碼如下:
public bool Add(CustomerFeedbackEntity m) { using (var conn=Connection) { string sql = @"INSERT INTO [dbo].[CustomerFeedback] ([BusType] ,[CustomerPhone] ,[BackType] ,[Content] ) VALUES (@BusType ,@CustomerPhone ,@BackType ,@Content )"; return conn.Execute(sql, m) > 0; } }
網(wǎng)友評論