https://docs.microsoft.com/zh-cn/sql/linux/quickstart-install-connect-red-hat
使用 Centos7,NetCore2.0,Dapper,MSSQL On Linux
按微软提示,顺利在LINUX上面安装了数据库,微软提供了三个客户端:sqlcmd,SSMS, vs core 使用SQL Server Management Studio进行远程连接.
大吉大利,今晚吃鸡!
随便测试一下性能,先贴一下,两台测试机的配置
MSSQL配置:Intel E8400 3.00GHz 双核,4G内存
批量写机配置:Intel i5-4590 3.30GHz 4核,8G内存
网络:100 Mbps
贴出测试代码:
/// <summary> /// 省份城市 /// </summary> public class ProvinceCity { /// <summary> /// 省份 /// </summary> public string Province { set; get; } /// <summary> /// 城市 /// </summary> public string City { set; get; } }
/// <summary> /// 订单表 /// </summary> public class TbOrders { /// <summary> /// 主健 /// </summary> public int Id { set; get; } /// <summary> /// 订单编号 /// </summary> public string OrderNo { set; get; } /// <summary> /// 货主ID /// </summary> public int ShipperID { set; get; } /// <summary> /// 车主ID /// </summary> public int CarOwnerID { set; get; } /// <summary> /// 发货省份 /// </summary> public string SendProvince { set; get; } /// <summary> /// 发货城市 /// </summary> public string SendCity { set; get; } /// <summary> /// 收货省份 /// </summary> public string DestProvince { set; get; } /// <summary> /// 收货城市 /// </summary> public string DestCity { set; get; } /// <summary> /// 运输价格 /// </summary> public decimal TranPrice { set; get; } /// <summary> /// 取消订单(1正常 2申请取消 3己取消) /// </summary> public int CancelStatus { set; get; } /// <summary> /// 订单状态,"待支付":100,"待运输":200,"运输中":300,"已签收":400,"已结算":500 /// </summary> public int Status { set; get; } /// <summary> /// 结算时间 /// </summary> public DateTime? SettlementDate { set; get; } /// <summary> /// 结算价格 /// </summary> public decimal? SettleTranPrice { set; get; } /// <summary> /// 保价(保险费用) /// </summary> public decimal SafePrice { set; get; } /// <summary> /// 总价格 /// </summary> public decimal TotalPrice { set; get; } /// <summary> /// 搬运价格 /// </summary> public decimal? CarryPrice { set; get; } /// <summary> /// 创建时间 /// </summary> public DateTime CreateTime { set; get; } }
这是一段JSON,是全国省份城市结构。主要用于后面生成订单,出发城市和收货城市的随机模拟。
[{'Province':'北京市','City':'北京市'},{'Province':'天津市','City':'天津市'},{'Province':'河北省','City':'石家庄市'},{'Province':'河北省','City':'唐山市'},{'Province':'河北省','City':'秦皇岛市'},{'Province':'河北省','City':'邯郸市'},{'Province':'河北省','City':'邢台市'},{'Province':'河北省','City':'保定市'},{'Province':'河北省','City':'张家口市'},{'Province':'河北省','City':'承德市'},{'Province':'河北省','City':'沧州市'},{'Province':'河北省','City':'廊坊市'},{'Province':'河北省','City':'衡水市'},{'Province':'山西省','City':'太原市'},{'Province':'山西省','City':'大同市'},{'Province':'山西省','City':'阳泉市'},{'Province':'山西省','City':'长治市'},{'Province':'山西省','City':'晋城市'},{'Province':'山西省','City':'朔州市'},{'Province':'山西省','City':'晋中市'},{'Province':'山西省','City':'运城市'},{'Province':'山西省','City':'忻州市'},{'Province':'山西省','City':'临汾市'},{'Province':'山西省','City':'吕梁市'},{'Province':'内蒙古自治区','City':'呼和浩特市'},{'Province':'内蒙古自治区','City':'包头市'},{'Province':'内蒙古自治区','City':'乌海市'},{'Province':'内蒙古自治区','City':'赤峰市'},{'Province':'内蒙古自治区','City':'通辽市'},{'Province':'内蒙古自治区','City':'鄂尔多斯市'},{'Province':'内蒙古自治区','City':'呼伦贝尔市'},{'Province':'内蒙古自治区','City':'巴彦淖尔市'},{'Province':'内蒙古自治区','City':'乌兰察布市'},{'Province':'内蒙古自治区','City':'兴安盟'},{'Province':'内蒙古自治区','City':'锡林郭勒盟'},{'Province':'内蒙古自治区','City':'阿拉善盟'},{'Province':'辽宁省','City':'沈阳市'},{'Province':'辽宁省','City':'大连市'},{'Province':'辽宁省','City':'鞍山市'},{'Province':'辽宁省','City':'抚顺市'},{'Province':'辽宁省','City':'本溪市'},{'Province':'辽宁省','City':'丹东市'},{'Province':'辽宁省','City':'锦州市'},{'Province':'辽宁省','City':'营口市'},{'Province':'辽宁省','City':'阜新市'},{'Province':'辽宁省','City':'辽阳市'},{'Province':'辽宁省','City':'盘锦市'},{'Province':'辽宁省','City':'铁岭市'},{'Province':'辽宁省','City':'朝阳市'},{'Province':'辽宁省','City':'葫芦岛市'},{'Province':'吉林省','City':'长春市'},{'Province':'吉林省','City':'吉林市'},{'Province':'吉林省','City':'四平市'},{'Province':'吉林省','City':'辽源市'},{'Province':'吉林省','City':'通化市'},{'Province':'吉林省','City':'白山市'},{'Province':'吉林省','City':'*市'},{'Province':'吉林省','City':'白城市'},{'Province':'吉林省','City':'延边朝鲜族自治州'},{'Province':'黑龙江省','City':'哈尔滨市'},{'Province':'黑龙江省','City':'齐齐哈尔市'},{'Province':'黑龙江省','City':'鸡西市'},{'Province':'黑龙江省','City':'鹤岗市'},{'Province':'黑龙江省','City':'双鸭山市'},{'Province':'黑龙江省','City':'大庆市'},{'Province':'黑龙江省','City':'伊春市'},{'Province':'黑龙江省','City':'佳木斯市'},{'Province':'黑龙江省','City':'七台河市'},{'Province':'黑龙江省','City':'牡丹江市'},{'Province':'黑龙江省','City':'黑河市'},{'Province':'黑龙江省','City':'绥化市'},{'Province':'黑龙江省','City':'大兴安岭地区'},{'Province':'上海','City':'上海市'},{'Province':'江苏省','City':'南京市'},{'Province':'江苏省','City':'无锡市'},{'Province':'江苏省','City':'徐州市'},{'Province':'江苏省','City':'常州市'},{'Province':'江苏省','City':'苏州市'},{'Province':'江苏省','City':'南通市'},{'Province':'江苏省','City':'连云港市'},{'Province':'江苏省','City':'淮安市'},{'Province':'江苏省','City':'盐城市'},{'Province':'江苏省','City':'扬州市'},{'Province':'江苏省','City':'镇江市'},{'Province':'江苏省','City':'泰州市'},{'Province':'江苏省','City':'宿迁市'},{'Province':'浙江省','City':'杭州市'},{'Province':'浙江省','City':'宁波市'},{'Province':'浙江省','City':'温州市'},{'Province':'浙江省','City':'嘉兴市'},{'Province':'浙江省','City':'湖州市'},{'Province':'浙江省','City':'绍兴市'},{'Province':'浙江省','City':'金华市'},{'Province':'浙江省','City':'衢州市'},{'Province':'浙江省','City':'舟山市'},{'Province':'浙江省','City':'台州市'},{'Province':'浙江省','City':'丽水市'},{'Province':'安徽省','City':'合肥市'},{'Province':'安徽省','City':'芜湖市'},{'Province':'安徽省','City':'蚌埠市'},{'Province':'安徽省','City':'淮南市'},{'Province':'安徽省','City':'马鞍山市'},{'Province':'安徽省','City':'淮北市'},{'Province':'安徽省','City':'铜陵市'},{'Province':'安徽省','City':'安庆市'},{'Province':'安徽省','City':'黄山市'},{'Province':'安徽省','City':'滁州市'},{'Province':'安徽省','City':'阜阳市'},{'Province':'安徽省','City':'宿州市'},{'Province':'安徽省','City':'六安市'},{'Province':'安徽省','City':'亳州市'},{'Province':'安徽省','City':'池州市'},{'Province':'安徽省','City':'宣城市'},{'Province':'福建省','City':'福州市'},{'Province':'福建省','City':'厦门市'},{'Province':'福建省','City':'莆田市'},{'Province':'福建省','City':'三明市'},{'Province':'福建省','City':'泉州市'},{'Province':'福建省','City':'漳州市'},{'Province':'福建省','City':'南平市'},{'Province':'福建省','City':'龙岩市'},{'Province':'福建省','City':'宁德市'},{'Province':'江西省','City':'南昌市'},{'Province':'江西省','City':'景德镇市'},{'Province':'江西省','City':'萍乡市'},{'Province':'江西省','City':'九江市'},{'Province':'江西省','City':'新余市'},{'Province':'江西省','City':'鹰潭市'},{'Province':'江西省','City':'赣州市'},{'Province':'江西省','City':'吉安市'},{'Province':'江西省','City':'宜春市'},{'Province':'江西省','City':'抚州市'},{'Province':'江西省','City':'上饶市'},{'Province':'山东省','City':'济南市'},{'Province':'山东省','City':'青岛市'},{'Province':'山东省','City':'淄博市'},{'Province':'山东省','City':'枣庄市'},{'Province':'山东省','City':'东营市'},{'Province':'山东省','City':'烟台市'},{'Province':'山东省','City':'潍坊市'},{'Province':'山东省','City':'济宁市'},{'Province':'山东省','City':'泰安市'},{'Province':'山东省','City':'威海市'},{'Province':'山东省','City':'日照市'},{'Province':'山东省','City':'莱芜市'},{'Province':'山东省','City':'临沂市'},{'Province':'山东省','City':'德州市'},{'Province':'山东省','City':'聊城市'},{'Province':'山东省','City':'滨州市'},{'Province':'山东省','City':'菏泽市'},{'Province':'河南省','City':'郑州市'},{'Province':'河南省','City':'开封市'},{'Province':'河南省','City':'洛阳市'},{'Province':'河南省','City':'平顶山市'},{'Province':'河南省','City':'安阳市'},{'Province':'河南省','City':'鹤壁市'},{'Province':'河南省','City':'新乡市'},{'Province':'河南省','City':'焦作市'},{'Province':'河南省','City':'济源市'},{'Province':'河南省','City':'濮阳市'},{'Province':'河南省','City':'许昌市'},{'Province':'河南省','City':'漯河市'},{'Province':'河南省','City':'三门峡市'},{'Province':'河南省','City':'南阳市'},{'Province':'河南省','City':'商丘市'},{'Province':'河南省','City':'信阳市'},{'Province':'河南省','City':'周口市'},{'Province':'河南省','City':'驻马店市'},{'Province':'湖北省','City':'武汉市'},{'Province':'湖北省','City':'黄石市'},{'Province':'湖北省','City':'十堰市'},{'Province':'湖北省','City':'宜昌市'},{'Province':'湖北省','City':'襄阳市'},{'Province':'湖北省','City':'鄂州市'},{'Province':'湖北省','City':'荆门市'},{'Province':'湖北省','City':'孝感市'},{'Province':'湖北省','City':'荆州市'},{'Province':'湖北省','City':'黄冈市'},{'Province':'湖北省','City':'咸宁市'},{'Province':'湖北省','City':'随州市'},{'Province':'湖北省','City':'恩施土家族苗族自治州'},{'Province':'湖北省','City':'仙桃市'},{'Province':'湖北省','City':'潜江市'},{'Province':'湖北省','City':'天门市'},{'Province':'湖北省','City':'神农架林区'},{'Province':'湖南省','City':'长沙市'},{'Province':'湖南省','City':'株洲市'},{'Province':'湖南省','City':'湘潭市'},{'Province':'湖南省','City':'衡阳市'},{'Province':'湖南省','City':'邵阳市'},{'Province':'湖南省','City':'岳阳市'},{'Province':'湖南省','City':'常德市'},{'Province':'湖南省','City':'张家界市'},{'Province':'湖南省','City':'益阳市'},{'Province':'湖南省','City':'郴州市'},{'Province':'湖南省','City':'永州市'},{'Province':'湖南省','City':'怀化市'},{'Province':'湖南省','City':'娄底市'},{'Province':'湖南省','City':'湘西土家族苗族自治州'},{'Province':'广东省','City':'广州市'},{'Province':'广东省','City':'韶关市'},{'Province':'广东省','City':'深圳市'},{'Province':'广东省','City':'珠海市'},{'Province':'广东省','City':'汕头市'},{'Province':'广东省','City':'佛山市'},{'Province':'广东省','City':'江门市'},{'Province':'广东省','City':'湛江市'},{'Province':'广东省','City':'茂名市'},{'Province':'广东省','City':'肇庆市'},{'Province':'广东省','City':'惠州市'},{'Province':'广东省','City':'梅州市'},{'Province':'广东省','City':'汕尾市'},{'Province':'广东省','City':'河源市'},{'Province':'广东省','City':'阳江市'},{'Province':'广东省','City':'清远市'},{'Province':'广东省','City':'东莞市'},{'Province':'广东省','City':'中山市'},{'Province':'广东省','City':'东沙群岛'},{'Province':'广东省','City':'潮州市'},{'Province':'广东省','City':'揭阳市'},{'Province':'广东省','City':'云浮市'},{'Province':'广西壮族自治区','City':'南宁市'},{'Province':'广西壮族自治区','City':'柳州市'},{'Province':'广西壮族自治区','City':'桂林市'},{'Province':'广西壮族自治区','City':'梧州市'},{'Province':'广西壮族自治区','City':'北海市'},{'Province':'广西壮族自治区','City':'防城港市'},{'Province':'广西壮族自治区','City':'钦州市'},{'Province':'广西壮族自治区','City':'贵港市'},{'Province':'广西壮族自治区','City':'玉林市'},{'Province':'广西壮族自治区','City':'百色市'},{'Province':'广西壮族自治区','City':'贺州市'},{'Province':'广西壮族自治区','City':'河池市'},{'Province':'广西壮族自治区','City':'来宾市'},{'Province':'广西壮族自治区','City':'崇左市'},{'Province':'海南省','City':'海口市'},{'Province':'海南省','City':'三亚市'},{'Province':'海南省','City':'三沙市'},{'Province':'海南省','City':'五指山市'},{'Province':'海南省','City':'琼海市'},{'Province':'海南省','City':'儋州市'},{'Province':'海南省','City':'文昌市'},{'Province':'海南省','City':'万宁市'},{'Province':'海南省','City':'东方市'},{'Province':'海南省','City':'定安县'},{'Province':'海南省','City':'屯昌县'},{'Province':'海南省','City':'澄迈县'},{'Province':'海南省','City':'临高县'},{'Province':'海南省','City':'白沙黎族自治县'},{'Province':'海南省','City':'昌江黎族自治县'},{'Province':'海南省','City':'乐东黎族自治县'},{'Province':'海南省','City':'陵水黎族自治县'},{'Province':'海南省','City':'保亭黎族苗族自治县'},{'Province':'海南省','City':'琼中黎族苗族自治县'},{'Province':'重庆','City':'重庆市'},{'Province':'四川省','City':'成都市'},{'Province':'四川省','City':'自贡市'},{'Province':'四川省','City':'攀枝花市'},{'Province':'四川省','City':'泸州市'},{'Province':'四川省','City':'德阳市'},{'Province':'四川省','City':'绵阳市'},{'Province':'四川省','City':'广元市'},{'Province':'四川省','City':'遂宁市'},{'Province':'四川省','City':'内江市'},{'Province':'四川省','City':'乐山市'},{'Province':'四川省','City':'南充市'},{'Province':'四川省','City':'眉山市'},{'Province':'四川省','City':'宜宾市'},{'Province':'四川省','City':'广安市'},{'Province':'四川省','City':'达州市'},{'Province':'四川省','City':'雅安市'},{'Province':'四川省','City':'巴中市'},{'Province':'四川省','City':'资阳市'},{'Province':'四川省','City':'阿坝藏族羌族自治州'},{'Province':'四川省','City':'甘孜藏族自治州'},{'Province':'四川省','City':'凉山彝族自治州'},{'Province':'贵州省','City':'贵阳市'},{'Province':'贵州省','City':'六盘水市'},{'Province':'贵州省','City':'遵义市'},{'Province':'贵州省','City':'安顺市'},{'Province':'贵州省','City':'铜仁市'},{'Province':'贵州省','City':'黔西南布依族苗族自治州'},{'Province':'贵州省','City':'毕节市'},{'Province':'贵州省','City':'黔东南苗族侗族自治州'},{'Province':'贵州省','City':'黔南布依族苗族自治州'},{'Province':'云南省','City':'昆明市'},{'Province':'云南省','City':'曲靖市'},{'Province':'云南省','City':'玉溪市'},{'Province':'云南省','City':'保山市'},{'Province':'云南省','City':'昭通市'},{'Province':'云南省','City':'丽江市'},{'Province':'云南省','City':'普洱市'},{'Province':'云南省','City':'临沧市'},{'Province':'云南省','City':'楚雄彝族自治州'},{'Province':'云南省','City':'红河哈尼族彝族自治州'},{'Province':'云南省','City':'文山壮族苗族自治州'},{'Province':'云南省','City':'西双版纳傣族自治州'},{'Province':'云南省','City':'大理白族自治州'},{'Province':'云南省','City':'德宏傣族景颇族自治州'},{'Province':'云南省','City':'怒江傈僳族自治州'},{'Province':'云南省','City':'迪庆藏族自治州'},{'Province':'*自治区','City':'拉萨市'},{'Province':'*自治区','City':'昌都地区'},{'Province':'*自治区','City':'山南地区'},{'Province':'*自治区','City':'日喀则地区'},{'Province':'*自治区','City':'那曲地区'},{'Province':'*自治区','City':'阿里地区'},{'Province':'*自治区','City':'林芝地区'},{'Province':'陕西省','City':'西安市'},{'Province':'陕西省','City':'铜川市'},{'Province':'陕西省','City':'宝鸡市'},{'Province':'陕西省','City':'咸阳市'},{'Province':'陕西省','City':'渭南市'},{'Province':'陕西省','City':'延安市'},{'Province':'陕西省','City':'汉中市'},{'Province':'陕西省','City':'榆林市'},{'Province':'陕西省','City':'安康市'},{'Province':'陕西省','City':'商洛市'},{'Province':'甘肃省','City':'兰州市'},{'Province':'甘肃省','City':'嘉峪关市'},{'Province':'甘肃省','City':'金昌市'},{'Province':'甘肃省','City':'白银市'},{'Province':'甘肃省','City':'天水市'},{'Province':'甘肃省','City':'武威市'},{'Province':'甘肃省','City':'张掖市'},{'Province':'甘肃省','City':'平凉市'},{'Province':'甘肃省','City':'酒泉市'},{'Province':'甘肃省','City':'庆阳市'},{'Province':'甘肃省','City':'定西市'},{'Province':'甘肃省','City':'陇南市'},{'Province':'甘肃省','City':'临夏回族自治州'},{'Province':'甘肃省','City':'甘南藏族自治州'},{'Province':'青海省','City':'西宁市'},{'Province':'青海省','City':'海东市'},{'Province':'青海省','City':'海北藏族自治州'},{'Province':'青海省','City':'黄南藏族自治州'},{'Province':'青海省','City':'海南藏族自治州'},{'Province':'青海省','City':'果洛藏族自治州'},{'Province':'青海省','City':'玉树藏族自治州'},{'Province':'青海省','City':'海西蒙古族藏族自治州'},{'Province':'宁夏回族自治区','City':'银川市'},{'Province':'宁夏回族自治区','City':'石嘴山市'},{'Province':'宁夏回族自治区','City':'吴忠市'},{'Province':'宁夏回族自治区','City':'固原市'},{'Province':'宁夏回族自治区','City':'中卫市'},{'Province':'**自治区','City':'乌鲁木齐市'},{'Province':'**自治区','City':'克拉玛依市'},{'Province':'**自治区','City':'吐鲁番地区'},{'Province':'**自治区','City':'哈密地区'},{'Province':'**自治区','City':'昌吉回族自治州'},{'Province':'**自治区','City':'博尔塔拉蒙古自治州'},{'Province':'**自治区','City':'巴音郭楞蒙古自治州'},{'Province':'**自治区','City':'阿克苏地区'},{'Province':'**自治区','City':'克孜勒苏柯尔克孜自治州'},{'Province':'**自治区','City':'喀什地区'},{'Province':'**自治区','City':'和田地区'},{'Province':'**自治区','City':'伊犁哈萨克自治州'},{'Province':'**自治区','City':'塔城地区'},{'Province':'**自治区','City':'阿勒泰地区'},{'Province':'**自治区','City':'石河子市'},{'Province':'**自治区','City':'阿拉尔市'},{'Province':'**自治区','City':'图木舒克市'},{'Province':'**自治区','City':'五家渠市'},{'Province':'*','City':'台北市'},{'Province':'*','City':'*市'},{'Province':'*','City':'台南市'},{'Province':'*','City':'台中市'},{'Province':'*','City':'金门县'},{'Province':'*','City':'南投县'},{'Province':'*','City':'基隆市'},{'Province':'*','City':'新竹市'},{'Province':'*','City':'嘉义市'},{'Province':'*','City':'新北市'},{'Province':'*','City':'宜兰县'},{'Province':'*','City':'新竹县'},{'Province':'*','City':'桃园县'},{'Province':'*','City':'苗栗县'},{'Province':'*','City':'彰化县'},{'Province':'*','City':'嘉义县'},{'Province':'*','City':'云林县'},{'Province':'*','City':'屏东县'},{'Province':'*','City':'台东县'},{'Province':'*','City':'花莲县'},{'Province':'*','City':'澎湖县'},{'Province':'*','City':'连江县'},{'Province':'香港特别行政区','City':'香港岛'},{'Province':'香港特别行政区','City':'九龙'},{'Province':'香港特别行政区','City':'新界'},{'Province':'澳门特别行政区','City':'澳门半岛'},{'Province':'澳门特别行政区','City':'离岛'}]
控制台写入程序:
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Threading; using Newtonsoft.Json; using System.Data.SqlClient; using System.Data; using Dapper; using System.Text; namespace ConsoleApp5 { class Program { private static int[] _statusItems = new[] { 100, 200, 300, 400, 500 }; private static Random _rand = new Random(); private static string _cityJson = "这就是上面那一段JSON,怕太长,没写这里,自己制制,粘贴"; private static List<ProvinceCity> _cityItems = JsonConvert.DeserializeObject<List<ProvinceCity>>(_cityJson); private static int _addCount = 0; static Timer _timer= new Timer(OutputResult, null, 60000, Timeout.Infinite); static void Main(string[] args) { Task.Run(AddOrder); Task.Run(AddOrder); while (true) { Console.ReadKey(); } } #region 创建订单 public static TbOrders CreateOrder() { //收,发货城市 var city = _cityItems[_rand.Next(0, _cityItems.Count)]; //订单状态 var status = _statusItems[_rand.Next(0, _statusItems.Count())]; //结算时间 DateTime? settlementDate = null; if (status == 500) settlementDate = DateTime.Now; return new TbOrders { OrderNo = DateTime.Now.Ticks.ToString(), ShipperID = _rand.Next(1000, 9000), CarOwnerID = _rand.Next(1000, 9000), SendProvince = city.Province, SendCity = city.City, DestProvince = city.Province, DestCity = city.City, TranPrice = _rand.Next(1000, 9000), CancelStatus = _rand.Next(1, 4), Status = status, SettlementDate = settlementDate, SettleTranPrice = _rand.Next(1000, 9000), SafePrice = _rand.Next(100, 900), TotalPrice = _rand.Next(1000, 9000), CarryPrice = _rand.Next(100, 900), CreateTime = DateTime.Now }; } #endregion #region 添加订单 public static async Task AddOrder() { IDbConnection conn = new SqlConnection("Data Source=192.168.99.7;Initial Catalog=oa;User Id=sa;Password=123"); while (true) { //添加订单 TbOrders order = CreateOrder(); StringBuilder sql = new StringBuilder(); sql.Append("INSERT INTO [oa].[dbo].[TbOrders] ([CancelStatus],[CarOwnerID],[CarryPrice],[CreateTime],[DestCity],[DestProvince],[OrderNo],[SafePrice],[SendCity],[SendProvince],[SettleTranPrice],[SettlementDate],[ShipperID],[Status],[TotalPrice],[TranPrice]) "); sql.Append("VALUES (@CancelStatus, @CarOwnerID, @CarryPrice, @CreateTime, @DestCity, @DestProvince, @OrderNo, @SafePrice, @SendCity, @SendProvince, @SettleTranPrice, @SettlementDate, @ShipperID, @Status, @TotalPrice, @TranPrice)"); await conn.ExecuteAsync(sql.ToString(), order); //数量+1 Interlocked.Increment(ref _addCount); } } #endregion #region 定期输出统计结果 public static void OutputResult(object state) { Console.WriteLine($"时间:{DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")},每分钟写入速度为:{_addCount}"); _addCount = 0; _timer.Change(60000, System.Threading.Timeout.Infinite); } #endregion } }
运行效果
先放着,写一天,两天,写入几亿条,再看看。
大吉大利,今晚吃鸡!
第二天,测试程序,写了一天一夜,等我stop它的时候,内存也涨暴至90%
看看写入多少数据,一共1.7亿条。哇,查询总行数花了5分多哎。 MssqlOnLinux整个文件包好像似乎不到200M。