[20191218]降序索引疑問4.txt

来源:https://www.cnblogs.com/lfree/archive/2019/12/18/12058084.html
-Advertisement-
Play Games

[20191218]降序索引疑問4.txt--//前幾天優化一個項目,我發現許多表裡面有有隱含欄位,一般開發很少建立函數索引.我自己檢查發現裡面存在大量的降序索引.--//我感覺有點奇怪,為什麼開發要建立大量降序索引有什麼好處呢?--//我在鏈接http://www.itpub.net/thread ...


[20191218]降序索引疑問4.txt

--//前幾天優化一個項目,我發現許多表裡面有有隱含欄位,一般開發很少建立函數索引.我自己檢查發現裡面存在大量的降序索引.
--//我感覺有點奇怪,為什麼開發要建立大量降序索引有什麼好處呢?

--//我在鏈接http://www.itpub.net/thread-2122088-1-1.html裡面問這個問題,sqysl的解答給了我很好的提示,我通過例子說明使用降
--//序索引的一點點好處,通過例子說明:

1.環境:
SCOTT@book> @ ver1
PORT_STRING         VERSION        BANNER
------------------- -------------- ----------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

SCOTT@book> alter system set pga_aggregate_target=4G;
System altered.

SCOTT@book> create table t (id1 number,id2 number,vc varchar2(50));
Table created.

create index i_t_id1_id2 on t (id1,id2);
create index i_t_id1desc_id2desc on t (id1 desc,id2 desc);
create index i_t_id1desc_id2 on t (id1 desc,id2 );
create index i_t_id1_id2desc on t (id1 ,id2 desc );

SCOTT@book> insert into t select rownum,rownum,lpad('a',50,'a') from dual connect by level<=1e6;
1000000 rows created.

SCOTT@book> commit ;
Commit complete.

--//分析略.
SCOTT@book> select index_name,index_type,blevel,leaf_blocks,distinct_keys from dba_indexes where owner=user and table_name='T';
INDEX_NAME                     INDEX_TYPE                      BLEVEL LEAF_BLOCKS DISTINCT_KEYS
------------------------------ --------------------------- ---------- ----------- -------------
I_T_ID1_ID2                    NORMAL                               2        2623       1000000
I_T_ID1DESC_ID2DESC            FUNCTION-BASED NORMAL                2        5877       1000000
I_T_ID1DESC_ID2                FUNCTION-BASED NORMAL                2        5618       1000000
I_T_ID1_ID2DESC                FUNCTION-BASED NORMAL                2        2753       1000000
--//無論那種倒序索引,索引都比正序索引大,特別是第1個欄位選擇desc的情況.因為我插入的欄位是自增欄位.
--//倒序索引分裂都是50-50分裂.

2.測試例子:
SCOTT@book> alter session set statistics_level = all;
Session altered.

SCOTT@book> select * from (select * from t where id1<=1e6 order by id1 desc,id2 ) where rownum<=10;
       ID1        ID2 VC
---------- ---------- --------------------------------------------------
   1000000    1000000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    999999     999999 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    999998     999998 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    999997     999997 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    999996     999996 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    999995     999995 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    999994     999994 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    999993     999993 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    999992     999992 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    999991     999991 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
10 rows selected.

SCOTT@book> @ dpc '' ''
PLAN_TABLE_OUTPUT
-------------------------------------
SQL_ID  20hb1uyyqx4tf, child number 0
-------------------------------------
select * from (select * from t where id1<=1e6 order by id1 desc,id2 )
where rownum<=10
Plan hash value: 404407004
-------------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                     | Name            | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time   | A-Rows |   A-Time   | Buffers |
-------------------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT              |                 |      1 |        |       |     4 (100)|          |     10 |00:00:00.01 |       6 |
|*  1 |  COUNT STOPKEY                |                 |      1 |        |       |            |          |     10 |00:00:00.01 |       6 |
|   2 |   VIEW                        |                 |      1 |     10 |   530 |     4   (0)| 00:00:01 |     10 |00:00:00.01 |       6 |
|   3 |    TABLE ACCESS BY INDEX ROWID| T               |      1 |   1000K|    58M|     4   (0)| 00:00:01 |     10 |00:00:00.01 |       6 |
|*  4 |     INDEX RANGE SCAN          | I_T_ID1DESC_ID2 |      1 |     10 |       |     3   (0)| 00:00:01 |     10 |00:00:00.01 |       4 |
-------------------------------------------------------------------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
   1 - SEL$1
   2 - SEL$2 / from$_subquery$_001@SEL$1
   3 - SEL$2 / T@SEL$2
   4 - SEL$2 / T@SEL$2
Predicate Information (identified by operation id):
---------------------------------------------------
   1 - filter(ROWNUM<=10)
   4 - access("T"."SYS_NC00004$">=HEXTORAW('3BFDFF')  AND "T"."SYS_NC00004$" IS NOT NULL)
       filter(SYS_OP_UNDESCEND("T"."SYS_NC00004$")<=1000000)
32 rows selected.
--//邏輯讀僅僅6個.而其它2個索引都無法達到這樣的效果.

select * from (select /*+ index(t I_T_ID1DESC_ID2DESC) */ * from t where id1<=1e6 order by id1 desc,id2 ) where rownum<=10;
select * from (select /*+ index_desc(t I_T_ID1DESC_ID2DESC) */ * from t where id1<=1e6 order by id1 desc,id2 ) where rownum<=10;

select * from (select /*+ index(t I_T_ID1_ID2) */ * from t where id1<=1e6 order by id1 desc,id2 ) where rownum<=10;
select * from (select /*+ index_desc(t I_T_ID1_ID2) */ * from t where id1<=1e6 order by id1 desc,id2 ) where rownum<=10;
--//結果不在貼出.大家可以自行測試.

3.繼續測試:

SCOTT@book> alter index I_T_ID1DESC_ID2 invisible;
Index altered.

SCOTT@book> select * from (select  * from t where id1<=1e6 order by id1 desc,id2 ) where rownum<=1;
       ID1        ID2 VC
---------- ---------- --------------------------------------------------
   1000000    1000000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

SCOTT@book> @ dpc '' ''
PLAN_TABLE_OUTPUT
-------------------------------------
SQL_ID  2r7j4a5gdhpnj, child number 0
-------------------------------------
select * from (select  * from t where id1<=1e6 order by id1 desc,id2 )
where rownum<=1

Plan hash value: 3299198703

----------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation               | Name | Starts | E-Rows |E-Bytes|E-Temp | Cost (%CPU)| E-Time   | A-Rows |   A-Time   | Buffers | Reads  |  OMem |  1Mem | Used-Mem |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT        |      |      1 |        |       |       | 17500 (100)|          |      1 |00:00:00.38 |    9285 |     74 |       |       |          |
|*  1 |  COUNT STOPKEY          |      |      1 |        |       |       |            |          |      1 |00:00:00.38 |    9285 |     74 |       |       |          |
|   2 |   VIEW                  |      |      1 |   1000K|    50M|       | 17500   (1)| 00:03:30 |      1 |00:00:00.38 |    9285 |     74 |       |       |          |
|*  3 |    SORT ORDER BY STOPKEY|      |      1 |   1000K|    58M|    69M| 17500   (1)| 00:03:30 |      1 |00:00:00.38 |    9285 |     74 |    65M|  2806K|          |
|*  4 |     TABLE ACCESS FULL   | T    |      1 |   1000K|    58M|       |  2744   (1)| 00:00:33 |   1000K|00:00:00.12 |    9285 |     74 |       |       |          |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------

Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------

   1 - SEL$1
   2 - SEL$2 / from$_subquery$_001@SEL$1
   3 - SEL$2
   4 - SEL$2 / T@SEL$2

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - filter(ROWNUM<=1)
   3 - filter(ROWNUM<=1)
   4 - filter("ID1"<=1000000)
32 rows selected.
--//oracle選擇全表掃描.

SCOTT@book> alter index I_T_ID1DESC_ID2 visible;
Index altered.

4.再繼續測試:
--//測試第1個欄位正序,第2個欄位倒序的情況.
SCOTT@book> select * from (select  * from t where id1<=1e6 order by id1 ,id2 desc ) where rownum<=5;
       ID1        ID2 VC
---------- ---------- --------------------------------------------------
         1          1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
         2          2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
         3          3 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
         4          4 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
         5          5 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

SCOTT@book> @ dpc '' ''
PLAN_TABLE_OUTPUT
-------------------------------------
SQL_ID  8f5yj8c3frpnc, child number 0
-------------------------------------
select * from (select  * from t where id1<=1e6 order by id1 ,id2 desc )
where rownum<=5
Plan hash value: 2787951352
-------------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                     | Name            | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time   | A-Rows |   A-Time   | Buffers |
-------------------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT              |                 |      1 |        |       |     4 (100)|          |      5 |00:00:00.01 |       6 |
|*  1 |  COUNT STOPKEY                |                 |      1 |        |       |            |          |      5 |00:00:00.01 |       6 |
|   2 |   VIEW                        |                 |      1 |      5 |   265 |     4   (0)| 00:00:01 |      5 |00:00:00.01 |       6 |
|   3 |    TABLE ACCESS BY INDEX ROWID| T               |      1 |   1000K|    58M|     4   (0)| 00:00:01 |      5 |00:00:00.01 |       6 |
|*  4 |     INDEX RANGE SCAN          | I_T_ID1_ID2DESC |      1 |      5 |       |     3   (0)| 00:00:01 |      5 |00:00:00.01 |       4 |
-------------------------------------------------------------------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
   1 - SEL$1
   2 - SEL$2 / from$_subquery$_001@SEL$1
   3 - SEL$2 / T@SEL$2
   4 - SEL$2 / T@SEL$2
Predicate Information (identified by operation id):
---------------------------------------------------
   1 - filter(ROWNUM<=5)
   4 - access("ID1"<=1000000)
31 rows selected.
--//可以發現很好第使用I_T_ID1_ID2DESC索引.邏輯讀也很小,僅僅6.

SCOTT@book> alter index I_T_ID1_ID2DESC invisible;
Index altered.

select * from (select  * from t where id1<=1e6 order by id1 ,id2 desc ) where rownum<=1;
SCOTT@book> select * from (select  * from t where id1<=1e6 order by id1 ,id2 desc ) where rownum<=5;
       ID1        ID2 VC
---------- ---------- --------------------------------------------------
         1          1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
         2          2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
         3          3 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
         4          4 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
         5          5 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

SCOTT@book> @ dpc '' ''
PLAN_TABLE_OUTPUT
-------------------------------------
SQL_ID  8f5yj8c3frpnc, child number 0
-------------------------------------
select * from (select  * from t where id1<=1e6 order by id1 ,id2 desc )
where rownum<=5

Plan hash value: 2145689175

-----------------------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                      | Name            | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time   | A-Rows |   A-Time   | Buffers | Reads  |
-----------------------------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT               |                 |      1 |        |       |     4 (100)|          |      5 |00:00:00.01 |       6 |      1 |
|*  1 |  COUNT STOPKEY                 |                 |      1 |        |       |            |          |      5 |00:00:00.01 |       6 |      1 |
|   2 |   VIEW                         |                 |      1 |      5 |   265 |     4   (0)| 00:00:01 |      5 |00:00:00.01 |       6 |      1 |
|   3 |    TABLE ACCESS BY INDEX ROWID | T               |      1 |   1000K|    58M|     4   (0)| 00:00:01 |      5 |00:00:00.01 |       6 |      1 |
|*  4 |     INDEX RANGE SCAN DESCENDING| I_T_ID1DESC_ID2 |      1 |      5 |       |     3   (0)| 00:00:01 |      5 |00:00:00.01 |       4 |      1 |
-----------------------------------------------------------------------------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
   1 - SEL$1
   2 - SEL$2 / from$_subquery$_001@SEL$1
   3 - SEL$2 / T@SEL$2
   4 - SEL$2 / T@SEL$2
Predicate Information (identified by operation id):
---------------------------------------------------
   1 - filter(ROWNUM<=5)
   4 - access("T"."SYS_NC00004$" IS NOT NULL AND "T"."SYS_NC00004$">=HEXTORAW('3BFDFF') )
       filter(SYS_OP_UNDESCEND("T"."SYS_NC00004$")<=1000000)
32 rows selected.

--//你會發現一個奇特現象,oracle會使用"倒過來"的一個索引,也就是id1 desc,id2 asc的索引.

SCOTT@book> alter index I_T_ID1DESC_ID2 invisible;
Index altered.

SCOTT@book> select * from (select  * from t where id1<=1e6 order by id1 ,id2 desc ) where rownum<=5;
       ID1        ID2 VC
---------- ---------- --------------------------------------------------
         1          1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
         2          2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
         3          3 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
         4          4 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
         5          5 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

SCOTT@book> @ dpc '' ''
PLAN_TABLE_OUTPUT
-------------------------------------
SQL_ID  8f5yj8c3frpnc, child number 0
-------------------------------------
select * from (select  * from t where id1<=1e6 order by id1 ,id2 desc )
where rownum<=5

Plan hash value: 3299198703

----------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation               | Name | Starts | E-Rows |E-Bytes|E-Temp | Cost (%CPU)| E-Time   | A-Rows |   A-Time   | Buffers | Reads  |  OMem |  1Mem | Used-Mem |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT        |      |      1 |        |       |       | 17500 (100)|          |      5 |00:00:00.41 |    9279 |   9269 |       |       |          |
|*  1 |  COUNT STOPKEY          |      |      1 |        |       |       |            |          |      5 |00:00:00.41 |    9279 |   9269 |       |       |          |
|   2 |   VIEW                  |      |      1 |   1000K|    50M|       | 17500   (1)| 00:03:30 |      5 |00:00:00.41 |    9279 |   9269 |       |       |          |
|*  3 |    SORT ORDER BY STOPKEY|      |      1 |   1000K|    58M|    69M| 17500   (1)| 00:03:30 |      5 |00:00:00.41 |    9279 |   9269 |  2048 |  2048 | 2048  (0)|
|*  4 |     TABLE ACCESS FULL   | T    |      1 |   1000K|    58M|       |  2744   (1)| 00:00:33 |   1000K|00:00:00.15 |    9279 |   9269 |       |       |          |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
   1 - SEL$1
   2 - SEL$2 / from$_subquery$_001@SEL$1
   3 - SEL$2
   4 - SEL$2 / T@SEL$2
Predicate Information (identified by operation id):
---------------------------------------------------
   1 - filter(ROWNUM<=5)
   3 - filter(ROWNUM<=5)
   4 - filter("ID1"<=1000000)
32 rows selected.
--//選擇的是全表掃描.

SCOTT@book> alter index i_t_id1desc_id2desc invisible;
Index altered.

SCOTT@book> select * from (select  * from t where id1<=1e6 order by id1 desc ,id2 desc ) where rownum<=1;
       ID1        ID2 VC
---------- ---------- --------------------------------------------------
   1000000    1000000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

SCOTT@book> @ dpc '' ''
PLAN_TABLE_OUTPUT
-------------------------------------
SQL_ID  66z6w3qc77jwp, child number 0
-------------------------------------
select * from (select  * from t where id1<=1e6 order by id1 desc ,id2
desc ) where rownum<=1
Plan hash value: 3873686303

----------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                      | Name        | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time   | A-Rows |   A-Time   | Buffers |
----------------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT               |             |      1 |        |       |     4 (100)|          |      1 |00:00:00.01 |       4 |
|*  1 |  COUNT STOPKEY                 |             |      1 |        |       |            |          |      1 |00:00:00.01 |       4 |
|   2 |   VIEW                         |             |      1 |      1 |    53 |     4   (0)| 00:00:01 |      1 |00:00:00.01 |       4 |
|   3 |    TABLE ACCESS BY INDEX ROWID | T           |      1 |   1000K|    58M|     4   (0)| 00:00:01 |      1 |00:00:00.01 |       4 |
|*  4 |     INDEX RANGE SCAN DESCENDING| I_T_ID1_ID2 |      1 |      1 |       |     3   (0)| 00:00:01 |      1 |00:00:00.01 |       3 |
----------------------------------------------------------------------------------------------------------------------------------------
--//也能很好的選擇正序索引.

5.總結:
--//通過以上測試,僅僅一種特殊的情況才需要建立倒序索引.存在id1 desc,id2 asc的情況下,建議完全可反過來建立(特別對於自增序列欄位),
--//就是反過來建立索引id1 ,id2 desc,這樣的索引占用磁碟空間更小.
--//其它情況我看不到降序索引的優勢.


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 1永久增加ip地址和路由 網卡永久添加ip地址 註釋:ens192為管理地址網卡,請根據實際情況進行修改,網關以192.168.160.1為例 複製一份網卡配置文件命名為ifcfg-ens192:1 cd /etc/sysconfig/network-scripts/ cp ifcfg-ens192 ...
  • 一個應用中決定加緩存(Redis,memcached)之前,要考慮的第一個問題就是,引進了緩存之後,會帶來哪些收益(利),付出哪些代價,引起哪些額外的問題(弊)? 任何新的中間件引進,收益和成本都是伴隨的,只有當利大於弊的情況下,能夠容忍其弊端(徹底解決?沒有額外代價又沒有負面影響,是不可能的,那就 ...
  • 有需要學習交流的友人請加入交流群的咱們一起,有問題一起交流,一起進步!前提是你是學技術的。感謝閱讀! 點此加入該群​jq.qq.com 首先採用Mysql存儲千億級的數據,確實是一項非常大的挑戰。Mysql單表確實可以存儲10億級的數據,只是這個時候性能非常差,項目中大量的實驗證明,Mysql單表容 ...
  • https://blog.csdn.net/zhangsheng_1992/article/details/52598396 https://blog.csdn.net/xiyangyang8110/article/details/52163106 https://blog.csdn.net/wei ...
  • https://sqlserver.code.blog/2019/12/18/realcase-failed-to-upgrade-sql-server-2016-sp2-cu11-installation-success-or-error-status-1648/ ...
  • Redis是一個常用的鍵值對資料庫。本篇分享一下如何輕鬆在睿江雲上實現基於windows的redis開發環境。 1. 登錄睿江雲 點擊右上角登錄框 ​ 進入登錄頁面,輸入賬號密碼登錄 ​ 進入控制台,選擇節點創建虛機 ​ 2. 新建雲主機 進入下一步,創建一臺實驗的雲主機,點擊“雲伺服器管理”。簡單 ...
  • 資料庫備份 例如:備份 /www/wwwroot 下麵的 task.db 資料庫 1.進入資料庫 [root@localhost ~]# sqlite3 /www/wwwroot/task.db 2.備份資料庫 sqlite> .output test.sql sqlite> .dump sqlit ...
  • 簡述問題“統計最新時刻處於某一狀態的設備的數量” 1. 首先子查詢結果,可以看到每個設備最新的狀態信息 2.1 在子查詢的基礎上,對設備狀態進行分組,進行統計每個狀態的設備數量 2.1.1 可以看到處於'火警'狀態的數量是2,沒有問題,但是看下一張圖 2.1.2 可以看到處於'故障'狀態的數量是(n ...
一周排行
    -Advertisement-
    Play Games
  • 示例項目結構 在 Visual Studio 中創建一個 WinForms 應用程式後,項目結構如下所示: MyWinFormsApp/ │ ├───Properties/ │ └───Settings.settings │ ├───bin/ │ ├───Debug/ │ └───Release/ ...
  • [STAThread] 特性用於需要與 COM 組件交互的應用程式,尤其是依賴單線程模型(如 Windows Forms 應用程式)的組件。在 STA 模式下,線程擁有自己的消息迴圈,這對於處理用戶界面和某些 COM 組件是必要的。 [STAThread] static void Main(stri ...
  • 在WinForm中使用全局異常捕獲處理 在WinForm應用程式中,全局異常捕獲是確保程式穩定性的關鍵。通過在Program類的Main方法中設置全局異常處理,可以有效地捕獲並處理未預見的異常,從而避免程式崩潰。 註冊全局異常事件 [STAThread] static void Main() { / ...
  • 前言 給大家推薦一款開源的 Winform 控制項庫,可以幫助我們開發更加美觀、漂亮的 WinForm 界面。 項目介紹 SunnyUI.NET 是一個基於 .NET Framework 4.0+、.NET 6、.NET 7 和 .NET 8 的 WinForm 開源控制項庫,同時也提供了工具類庫、擴展 ...
  • 說明 該文章是屬於OverallAuth2.0系列文章,每周更新一篇該系列文章(從0到1完成系統開發)。 該系統文章,我會儘量說的非常詳細,做到不管新手、老手都能看懂。 說明:OverallAuth2.0 是一個簡單、易懂、功能強大的許可權+可視化流程管理系統。 有興趣的朋友,請關註我吧(*^▽^*) ...
  • 一、下載安裝 1.下載git 必須先下載並安裝git,再TortoiseGit下載安裝 git安裝參考教程:https://blog.csdn.net/mukes/article/details/115693833 2.TortoiseGit下載與安裝 TortoiseGit,Git客戶端,32/6 ...
  • 前言 在項目開發過程中,理解數據結構和演算法如同掌握蓋房子的秘訣。演算法不僅能幫助我們編寫高效、優質的代碼,還能解決項目中遇到的各種難題。 給大家推薦一個支持C#的開源免費、新手友好的數據結構與演算法入門教程:Hello演算法。 項目介紹 《Hello Algo》是一本開源免費、新手友好的數據結構與演算法入門 ...
  • 1.生成單個Proto.bat內容 @rem Copyright 2016, Google Inc. @rem All rights reserved. @rem @rem Redistribution and use in source and binary forms, with or with ...
  • 一:背景 1. 講故事 前段時間有位朋友找到我,說他的窗體程式在客戶這邊出現了卡死,讓我幫忙看下怎麼回事?dump也生成了,既然有dump了那就上 windbg 分析吧。 二:WinDbg 分析 1. 為什麼會卡死 窗體程式的卡死,入口門檻很低,後續往下分析就不一定了,不管怎麼說先用 !clrsta ...
  • 前言 人工智慧時代,人臉識別技術已成為安全驗證、身份識別和用戶交互的關鍵工具。 給大家推薦一款.NET 開源提供了強大的人臉識別 API,工具不僅易於集成,還具備高效處理能力。 本文將介紹一款如何利用這些API,為我們的項目添加智能識別的亮點。 項目介紹 GitHub 上擁有 1.2k 星標的 C# ...