[C#] 初探 iBoxDB 關於百萬資料的測試數據

2022-11-17


昨天聊聊有關於 iBoxDB 關於 Transaction 的操作測試 ,這一篇來聊聊關於自己測試上面的數據

一樣我使用 User 這物件,我寫入一百萬的資料試試看,然後我按照範例試試看做 index 之後測試一下數據




話不多說,直接開始寫入一百萬的 User 資料,其中因為考慮到非同步的需求我直接使用 Parallel.For 進行測試



Result:

=============================== INSERT 1,000,000  ===============================

花費時間:00:38:46.5747623

數量:1000000


這是我的電腦配置硬碟是SSD ,還是需要花到 38 分鐘,我是覺得蠻快的這速度其實並不慢,當然這很主觀


接下來就是測試搜尋,我是搜尋 Salary 欄位 >=1000 且 <=2000


Result:

=============================== TEST SEARCH RANGE  ===============================

Count:9

花費時間:00:00:19.5392816

{"Birth":"2022-11-17T10:56:47.7600089+08:00","Id":"DONMA-ID-18","Name":"許當麻","Salary":1999.98}

{"Birth":"2022-11-17T10:56:47.7455168+08:00","Id":"DONMA-ID-17","Name":"許當麻","Salary":1888.87}

{"Birth":"2022-11-17T10:56:47.7378483+08:00","Id":"DONMA-ID-16","Name":"許當麻","Salary":1777.76}

{"Birth":"2022-11-17T10:56:47.7273404+08:00","Id":"DONMA-ID-15","Name":"許當麻","Salary":1666.65}

{"Birth":"2022-11-17T10:56:47.7256326+08:00","Id":"DONMA-ID-14","Name":"許當麻","Salary":1555.54}

{"Birth":"2022-11-17T10:56:47.7083998+08:00","Id":"DONMA-ID-13","Name":"許當麻","Salary":1444.43}

{"Birth":"2022-11-17T10:56:47.6957329+08:00","Id":"DONMA-ID-12","Name":"許當麻","Salary":1333.32}

{"Birth":"2022-11-17T10:56:47.6880246+08:00","Id":"DONMA-ID-11","Name":"許當麻","Salary":1222.21}

{"Birth":"2022-11-17T10:56:47.7159404+08:00","Id":"DONMA-ID-10","Name":"許當麻","Salary":1111.10}

花了 19 秒鐘


取得所有資料

auto.Cube().Select<User>("from USERS1M");

取得所有的資料還原成為物件 花費時間:00:00:14.4029608

我發現官方有關於製作索引的部分我測試了一下
boxDB.GetConfig().EnsureIndex<User>("USERS1M","Id","Name","Salary", "Birth");

但是結果我就不給了,因為其實跟沒有做測起來查詢結果差不了多少,我不知道問題出在哪裡,反正目前如果是有超大量資料我會用另外的手法做index

所以我就沒有細部研究了,如果有其他前輩有測試出來數據或是我的哪邊寫法不對煩請再跟我說一下,感恩


參考文獻:

https://z.itpub.net/article/detail/25E0BA7DA60324041EC35C58CFD7C95C

https://www.bookstack.cn/read/iBoxDB/143003

https://blog.51cto.com/u_15162069/2760340

https://www.cxyzjd.com/article/lile1234_show/78771292

https://github.com/iboxdb/iboxdb.github.io

https://iboxdb.github.io/


當麻許的超技八 2014 | Donma Hsu Design.