關於sql指令碼效能的一些研究

2021-05-28 12:51:48 字數 1569 閱讀 3723

select

a.*from

[function] a

where

not exists (

select funid from relfunpakagefun b 

where funpakageid = '786d25cb-8e2e-4f2d-a893-808f1ac24ae5' and a.funid = b.funid

)select

*from

[function] a

where

not exists (

select * from relfunpakagefun b 

where funpakageid = '786d25cb-8e2e-4f2d-a893-808f1ac24ae5' and a.funid = b.funid

)結論:not exists 內是否使用*號對於效能沒有影響

select * from tenant

select

[tenantid]

,[fullname]

,[shortname]

,[adminid]

,[status]

,[createtime]

,[creater]

,[edittime]

,[editor]

from tenant

結論:*與寫明各列效能相差不大,在列不是多得離譜的情況下

select

a.*from

[function] a

where

not exists (

select funid from relfunpakagefun b 

where funpakageid = '786d25cb-8e2e-4f2d-a893-808f1ac24ae5' and a.funid = b.funid

)select

*from

[function]

where

funid not in (

select funid from relfunpakagefun

where funpakageid = '786d25cb-8e2e-4f2d-a893-808f1ac24ae5'

)結論:exists相比in有更高的索引利用率,但實際效率相差並不大,除非海量資料否則使用者不會有等待時間上的差別

select count(*) from tbtest

select count(tid) from tbtest

select count(tint) from tbtest

select count(tname) from tbtest

select count(tinfo) from tbtest

tid唯一索引,tint無索引,tname不唯一索引,tinfo無索引

tin int,tin int,tname varchar(50),tinfo varchar(50)

結論:count時*與唯一索引速度相同,速度與型別無關,不唯一索引慢於唯一索引,無索引最慢。count應使用*,避免寫的不是唯一索引

關於A 演算法的一些研究

公式 f g h 代價計算,尋路代價最小的就是我們要找的 g 表示從起點 a 移動到網格上指定方格的移動耗費 可沿斜方向移動 h 表示從指定的方格移動到終點 b 的預計耗費 h 有很多計算方法,這裡我們設定只可以上下左右移動 下面拿個例子說明一下 原文參考 假如從a尋路到b 尋路步驟 1.從起點a開...

關於mirai的一些研究

關於mirai的一些研究 配置好對應的go開發環境,即可進行編譯,生成了主要的檔案 badbot為殭屍節點的可執行檔案,cnc為主控端的可執行檔案,其它一些為輔助工具。如下圖所示編譯主控端源 go語句編寫 生成可執行檔案cnc,執行cnc,在本地開啟了23和101的埠監聽 主控端的 主要由go語言編...

關於mirai的一些研究

關於mirai的一些研究 配置好對應的go開發環境,即可進行編譯,生成了主要的檔案 badbot為殭屍節點的可執行檔案,cnc為主控端的可執行檔案,其它一些為輔助工具。如下圖所示編譯主控端源 go語句編寫 生成可執行檔案cnc,執行cnc,在本地開啟了23和101的埠監聽 主控端的 主要由go語言編...