Hive執行計劃之什麼是hiveSQL向量化模式及優化詳解

来源:https://www.cnblogs.com/lubians/archive/2023/06/09/17470178.html
-Advertisement-
Play Games

Hive開啟向量化模式也是hiveSQL優化方法中的一種,可以提升hive查詢速率,也叫hive矢量化。 問題1:那麼什麼是hive向量化模式呢? 問題2:hive向量化什麼情況下可以被使用,或者說它有哪些使用場景呢? 問題3:如何查看hive向量化使用的相關信息? ## 1.什麼是hive向量化模 ...


Hive開啟向量化模式也是hiveSQL優化方法中的一種,可以提升hive查詢速率,也叫hive矢量化。

問題1:那麼什麼是hive向量化模式呢?

問題2:hive向量化什麼情況下可以被使用,或者說它有哪些使用場景呢?

問題3:如何查看hive向量化使用的相關信息?

1.什麼是hive向量化模式

hive向量化模式是hive的一個特性,也叫hive矢量化,在沒有引入向量化的執行模式之前,一般的查詢操作一次只處理一行數據,在向量化查詢執行時一次處理1024行的塊來簡化系統底層的操作,提高了數據處理的性能。

在底層,hive提供的向量模式,並不是重寫了Mapper函數,而是通過實現inputformat介面,創建了VectorizedParquetInputFormat類,來構建一個批量輸入的數組。

向量化模式開啟的方式如下:

-- 開啟hive向量化模式
set hive.vectorized.execution.enabled = true;

2.Hive向量化模式支持的使用場景

Hive向量化模式並不是可以直接使用,它對使用的計算引擎,使用數據的數據類型,以及使用的SQL函數都有一定的要求。

2.1 hive向量化模式使用前置條件

  • 不同的計算引擎支持程度不一樣:MR計算引擎僅支持Map階段的向量化,Tez和Spark計算引擎可以支持Map階段和Reduce階段的向量化。

  • hive文件存儲類型必須為ORC或者Parquet等列存儲文件類型。

2.2 向量模式支持的數據類型

  • tinyint
  • smallint
  • int
  • bigint
  • boolean
  • float
  • double
  • decimal
  • date
  • timestamp
  • string

以上數據類型為向量化模式支持的數據類型,如果使用其他數據類型,例如array和map等,開啟了向量化模式查詢,查詢操作將使用標準的方式單行執行,但不會報錯。

2.3 向量化模式支持的函數

算數表達式: +, -, *, /, %
邏輯關係:AND, OR, NOT
比較關係(過濾器): <, >, <=, >=, =, !=, BETWEEN, IN ( list-of-constants ) as filters
使用 AND, OR, NOT, <, >, <=, >=, =, != 等布爾值表達式(非過濾器)
空值校驗:IS [NOT] NULL
所有的數學函數,例如 SIN, LOG等
字元串函數: SUBSTR, CONCAT, TRIM, LTRIM, RTRIM, LOWER, UPPER, LENGTH
類型轉換:cast
Hive UDF函數, 包括標準和通用的UDF函數
日期函數:YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, UNIX_TIMESTAMP
IF條件表達式

以上函數表達式在運行時支持使用向量化模式。

3.如何查看hiveSQL向量化運行信息

查看hive向量化信息是前置的,可以通過執行計劃命令explain vectorization查看向量化描述信息。當然,執行中,也可以通過日誌瞭解向量化執行信息,但相對篩選關鍵信息比較複雜。

explain vectorization是在hive2.3.0版本之後發佈的功能,可以查看map階段和reduce階段為什麼沒有開啟矢量化模式,類似調試功能。

explain vectorization支持的語法:explain vectorization [only] [summary|operator|expression|detail]

  • explain vectorization:不帶後置參數,顯示執行計劃的向量化信息(啟用向量化)以及 Map 和 Reduce 階段的摘要。
  • only:這個命令只顯示向量化模式相關的描述信息,這個參數和後面的其他參數是可以一起使用的,與它相對的是explain vectorization。
  • summary:這是個預設參數,任何命令後面預設有該參數。
  • operator:補充顯示運算符的向量化信息。例如數據過濾向量化。還包括summary的所有信息。
  • expression:補充顯示表達式的向量化信息。例如謂詞表達式。還包括 summary 和 operator 的所有信息。
  • detail:顯示最詳細級別的向量化信息。它包括summary、operator、expression的所有信息。

接下來我們通過實例來查看以上命令的展示內容:

3.1 explain vectorization only只查詢向量化描述信息內容

例1 關閉向量化模式的情況下,使用explain vectorization only。

-- 關閉向量化模式
set hive.vectorized.execution.enabled = false;
explain vectorization only
select age,count(0) as num from temp.user_info_all where ymd = '20230505'
and age < 30 and nick like '%小%'
group by age;

執行結果:

PLAN VECTORIZATION:
  enabled: false		#標識向量化模式沒有開啟
  enabledConditionsNotMet: [hive.vectorized.execution.enabled IS false]  #未開啟原因

如上,如果關閉向量化模式,輸出結果中PLAN VECTORIZATION 這裡可以看到該模式沒有被開啟,原因是沒有滿足enabledConditionsNotMet 指代的條件。

例2 開啟向量化模式的情況下,使用explain vectorization only。

-- 開啟向量化模式
set hive.vectorized.execution.enabled = true;
explain vectorization only
select age,count(0) as num from temp.user_info_all where ymd = '20230505'
and age < 30 and nick like '%小%'
group by age;

執行結果:

PLAN VECTORIZATION:
  enabled: true
  enabledConditionsMet: [hive.vectorized.execution.enabled IS true]

STAGE DEPENDENCIES:
  Stage-1 is a root stage
  Stage-0 depends on stages: Stage-1

STAGE PLANS:
  Stage: Stage-1
    Map Reduce
      Execution mode: vectorized
      Map Vectorization:
          enabled: true
          enabledConditionsMet: hive.vectorized.use.vectorized.input.format IS true
          groupByVectorOutput: true
          inputFileFormats: org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat
          allNative: false
          usesVectorUDFAdaptor: false
          vectorized: true
      Reduce Vectorization:
          enabled: false
          enableConditionsMet: hive.vectorized.execution.reduce.enabled IS true
          enableConditionsNotMet: hive.execution.engine mr IN [tez, spark] IS false

  Stage: Stage-0
    Fetch Operator

執行結果有三部分內容:

  • PLAN VECTORIZATION
  • STAGE DEPENDENCIES
  • STAGE PLANS

其中STAGE PLANS列印的並不是explain中map和reduce階段的運行信息,而是這兩個階段使用向量化模式的信息。

對以上案例內容進行關鍵詞解讀:

  • Execution mode:當前的執行模式,vectorized表示當前模式是向量化的模式。
  • Map Vectorization:當前是map階段的向量化執行模式信息。
  • enabled:是否開啟該階段向量化模式,true表示開啟,false表示關閉。在上面案例中Map Vectorization階段是開啟,Reduce Vectorization階段是關閉。
  • enabledConditionsMet:表示當前階段,開啟向量化模式已經滿足的條件。
  • enableConditionsNotMet:表示當前階段,開啟向量化模式未滿足的條件。
  • groupByVectorOutput:標識該階段分組聚合操作是否開啟向量化模式。
  • inputFileFormats:當前階段,輸入的文件格式。
  • allNative:是否都是本地化操作,false表示不是。
  • usesVectorUDFAdaptor:值為true時,表示至少有一個向量化表達式在使用VectorUDFAdaptor(向量化udf適配器)
  • vectorized:向量化模式執行是否成功,true為是向量化執行,false為不是向量化執行。
  • Reduce Vectorization:reduce階段向量化模式執行信息。

以上整個過程在map階段執行了向量化模式,在reduce階段沒有執行向量化模式,是因為上文提到的reduce階段mr計算引擎不支持,需要tez或spark計算引擎。

3.2 explain vectorization 查看hive向量化模式執行信息

可以執行以下命令:

-- 開啟向量化模式
set hive.vectorized.execution.enabled = true;
explain vectorization only summary
select age,count(0) as num from temp.user_info_all where ymd = '20230505'
and age < 30 and nick like '%小%'
group by age;

會發現explain vectorization only命令和explain vectorization only summary命令執行結果完全一致

後續其他命令也類似,explain vectorization等同於explain vectorization summary,summary參數是一個預設參數,可以忽略。

例3 使用explain vectorization命令查看hive向量化模式執行信息。

-- 開啟向量化模式
set hive.vectorized.execution.enabled = true;
explain vectorization
select age,count(0) as num from temp.user_info_all where ymd = '20230505'
and age < 30 and nick like '%小%'
group by age;

其執行結果是explain和explain vectorization only兩者相加執行結果:

PLAN VECTORIZATION:
  enabled: true
  enabledConditionsMet: [hive.vectorized.execution.enabled IS true]

STAGE DEPENDENCIES:
  Stage-1 is a root stage
  Stage-0 depends on stages: Stage-1

STAGE PLANS:
  Stage: Stage-1
    Map Reduce
      Map Operator Tree:
          TableScan
            alias: user_info_all
            Statistics: Num rows: 32634295 Data size: 783223080 Basic stats: COMPLETE Column stats: NONE
            Filter Operator
              predicate: ((age < 30) and (nick like '%小%')) (type: boolean)
              Statistics: Num rows: 5439049 Data size: 130537176 Basic stats: COMPLETE Column stats: NONE
              Select Operator ... 	#省略部分
      # 向量化模式描述信息
      Execution mode: vectorized
      Map Vectorization:
          enabled: true
          enabledConditionsMet: hive.vectorized.use.vectorized.input.format IS true
          groupByVectorOutput: true
          inputFileFormats: org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat
          allNative: false
          usesVectorUDFAdaptor: false
          vectorized: true
      Reduce Vectorization:
          enabled: false
          enableConditionsMet: hive.vectorized.execution.reduce.enabled IS true
          enableConditionsNotMet: hive.execution.engine mr IN [tez, spark] IS false
      Reduce Operator Tree:
        Group By Operator
          aggregations: count(VALUE._col0)
          ...  	#省略部分

  Stage: Stage-0
    Fetch Operator
      limit: -1
      Processor Tree:
        ListSink

... 為省略了一部分信息。

3.3 使用operator查看運算符的向量化信息

使用explain vectorization operator可以查看顯示執行計划過程中運算符的向量化信息和explain運行階段信息。

簡化版為explain vectorization only operator,加only相對前者少的部分為explain運行階段信息,下同。explain運行階段信息我們就不查詢了,感興趣小伙伴可以自行查詢查看。

例4 簡化版為explain vectorization only operator查看hiveSQL矢量化描述信息。

set hive.vectorized.execution.enabled = true;
explain vectorization only operator
select age,count(0) as num from temp.user_info_all where ymd = '20230505'
and age < 30 and nick like '%小%'
group by age;

執行結果:

PLAN VECTORIZATION:
  enabled: true
  enabledConditionsMet: [hive.vectorized.execution.enabled IS true]

STAGE DEPENDENCIES:
  Stage-1 is a root stage
  Stage-0 depends on stages: Stage-1

STAGE PLANS:
  Stage: Stage-1
    Map Reduce
      Map Operator Tree:
      			# 表掃描的向量化信息
            TableScan Vectorization:
            		# 讀表採用本地的向量化模式掃描
                native: true
              # 過濾操作的向量化信息
              Filter Vectorization:
              		# 過濾操作的類
                  className: VectorFilterOperator
                  # 過濾採用本地的向量化模式
                  native: true
                # 列篩選的向量化信息
                Select Vectorization:
                    className: VectorSelectOperator
                    native: true
                  # 聚合操作的向量化信息
                  Group By Vectorization:
                      className: VectorGroupByOperator
                      # 輸出採用向量化輸出
                      vectorOutput: true
                      #非本地操作
                      native: false
                    # reduce output向量化信息
                    Reduce Sink Vectorization:
                        className: VectorReduceSinkOperator
                        native: false
                        # 已滿足的Reduce Sink向量化條件
                        nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, Not ACID UPDATE or DELETE IS true, No buckets IS true, No TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
                        # 不滿足的Reduce Sink向量化條件
                        nativeConditionsNotMet: hive.execution.engine mr IN [tez, spark] IS false, Uniform Hash IS false
      # 向量化描述信息,同explain vectorization only,不作標註了。
      Execution mode: vectorized
      Map Vectorization:
          enabled: true
          enabledConditionsMet: hive.vectorized.use.vectorized.input.format IS true
          groupByVectorOutput: true
          inputFileFormats: org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat
          allNative: false
          usesVectorUDFAdaptor: false
          vectorized: true
      Reduce Vectorization:
          enabled: false
          enableConditionsMet: hive.vectorized.execution.reduce.enabled IS true
          enableConditionsNotMet: hive.execution.engine mr IN [tez, spark] IS false
      Reduce Operator Tree:
          Group By Vectorization:
              vectorOutput: false
              native: false

  Stage: Stage-0
    Fetch Operator

以上內容關鍵詞在代碼塊有行註釋標註,可以看到explain vectorization only operator命令多了在explain執行計划過程中增加了具體每一個運算符(operator)步驟的是否向量化及具體信息。如果不滿足向量化步驟,哪些條件滿足,哪些條件不滿足,也做了標註。

3.4 使用expression顯示欄位粒度的向量化信息

expression:補充顯示表達式的向量化信息,例如謂詞表達式。還包括 summary 和 operator 的所有信息。

例5 簡化版explain vectorization only expression命令查看hiveSQL執行計劃表達式的向量化信息。

set hive.vectorized.execution.enabled = true;
explain vectorization only expression
select age,count(0) as num from temp.user_info_all where ymd = '20230505'
and age < 30 and nick like '%小%'
group by age;

執行結果:

# 同explain vectorization
PLAN VECTORIZATION:
  enabled: true
  enabledConditionsMet: [hive.vectorized.execution.enabled IS true]

# 同explain vectorization
STAGE DEPENDENCIES:
  Stage-1 is a root stage
  Stage-0 depends on stages: Stage-1

STAGE PLANS:
  Stage: Stage-1
    Map Reduce
      Map Operator Tree:
            TableScan Vectorization:
                native: true
                # 表示表掃描後有25列。
                projectedOutputColumns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
              Filter Vectorization:
                  className: VectorFilterOperator
                  native: true
                  # 表示謂詞過濾少選有兩列,以及過濾條件的內容。
                  predicateExpression: FilterExprAndExpr(children: FilterLongColLessLongScalar(col 11, val 30), FilterStringColLikeStringScalar(col 7, pattern %小%))
                Select Vectorization:
                    className: VectorSelectOperator
                    native: true
                    # 表示進行列篩選的具體列,這裡是第12列,數組下標為11.如果為空[],則表示任何一個列。
                    projectedOutputColumns: [11]
                  Group By Vectorization:
                  		# 表示使用VectorUDAFCount的方法進行count計數統計以及輸出類型。
                      aggregators: VectorUDAFCount(ConstantVectorExpression(val 0) -> 25:int) -> bigint
                      className: VectorGroupByOperator
                      vectorOutput: true
                      # 聚合列
                      keyExpressions: col 11
                      native: false
                      # 輸出為一個新的數組,只有一列
                      projectedOutputColumns: [0]
                    Reduce Sink Vectorization:
                        className: VectorReduceSinkOperator
                        native: false
                        nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, Not ACID UPDATE or DELETE IS true, No buckets IS true, No TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
                        nativeConditionsNotMet: hive.execution.engine mr IN [tez, spark] IS false, Uniform Hash IS false
      # 向量化描述信息,同explain vectorization only,不作標註了。
      Execution mode: vectorized
      Map Vectorization:
          enabled: true
          enabledConditionsMet: hive.vectorized.use.vectorized.input.format IS true
          groupByVectorOutput: true
          inputFileFormats: org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat
          allNative: false
          usesVectorUDFAdaptor: false
          vectorized: true
      Reduce Vectorization:
          enabled: false
          enableConditionsMet: hive.vectorized.execution.reduce.enabled IS true
          enableConditionsNotMet: hive.execution.engine mr IN [tez, spark] IS false
      Reduce Operator Tree:
          Group By Vectorization:
              vectorOutput: false
              native: false
              projectedOutputColumns: null

  Stage: Stage-0
    Fetch Operator

以上列印信息內容可以看出 explain vectorization only expression命令相對列印的信息是更細粒度到欄位級別的信息了。基本上將操作的每一列是否使用向量化處理都列印了出來,這樣我們可以很好的判斷哪些欄位類型是不支持向量化模式的。

3.5 使用detail查看最詳細級別的向量化信息

explain vectorization only detail 查看最詳細級別的向量化信息。它包括summary、operator、expression的所有信息。

例6 explain vectorization only detail 查看最詳細級別的向量化信息。

set hive.vectorized.execution.enabled = true;
explain vectorization only detail
select age,count(0) as num from temp.user_info_all where ymd = '20230505'
and age < 30 and nick like '%小%'
group by age;

執行結果:

PLAN VECTORIZATION:
  enabled: true
  enabledConditionsMet: [hive.vectorized.execution.enabled IS true]

STAGE DEPENDENCIES:
  Stage-1 is a root stage
  Stage-0 depends on stages: Stage-1

# 同explain vectorization only expression
STAGE PLANS:
  Stage: Stage-1
    Map Reduce
      Map Operator Tree:
            TableScan Vectorization:
                native: true
                projectedOutputColumns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
              Filter Vectorization:
                  className: VectorFilterOperator
                  native: true
                  predicateExpression: FilterExprAndExpr(children: FilterLongColLessLongScalar(col 11, val 30), FilterStringColLikeStringScalar(col 7, pattern %小%))
                Select Vectorization:
                    className: VectorSelectOperator
                    native: true
                    projectedOutputColumns: [11]
                  Group By Vectorization:
                      aggregators: VectorUDAFCount(ConstantVectorExpression(val 0) -> 25:int) -> bigint
                      className: VectorGroupByOperator
                      vectorOutput: true
                      keyExpressions: col 11
                      native: false
                      projectedOutputColumns: [0]
                    Reduce Sink Vectorization:
                        className: VectorReduceSinkOperator
                        native: false
                        nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, Not ACID UPDATE or DELETE IS true, No buckets IS true, No TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
                        nativeConditionsNotMet: hive.execution.engine mr IN [tez, spark] IS false, Uniform Hash IS false
      # 向量化描述信息這裡做了更詳細的描述
      Execution mode: vectorized
      Map Vectorization:
          enabled: true
          enabledConditionsMet: hive.vectorized.use.vectorized.input.format IS true
          groupByVectorOutput: true
          inputFileFormats: org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat
          allNative: false
          usesVectorUDFAdaptor: false
          vectorized: true
          rowBatchContext:
              dataColumnCount: 24
              includeColumns: [7, 11]
              dataColumns: uid:bigint, reg_time:string, cc:string, client:string, if_new:int, last_location:string, platform_reg:string, nick:string, gender:int, birthday:string, constellation:string, age:bigint, description:string, is_realname:int, realname_date:string, last_active_day:string, is_active:int, user_status:int, user_ua:string, vst_cnt:bigint, vst_dur:bigint, is_vip:int, chat_uv:bigint, chat_cnt:bigint
              partitionColumnCount: 1
              partitionColumns: ymd:string
              scratchColumnTypeNames: bigint
      Reduce Vectorization:
          enabled: false
          enableConditionsMet: hive.vectorized.execution.reduce.enabled IS true
          enableConditionsNotMet: hive.execution.engine mr IN [tez, spark] IS false
      Reduce Operator Tree:
          Group By Vectorization:
              vectorOutput: false
              native: false
              projectedOutputColumns: null

  Stage: Stage-0
    Fetch Operator

通過以上內容可以看出 explain vectorization only detail列印的信息其中執行計劃部分內容和explain vectorization only expression粒度一致,在向量化描述信息部分做了更細粒度的描述,到欄位級別。

以上就是hive向量化explain vectorization相關參數的使用,其命令在我們使用向量化模式中進行驗證支持的函數和數據類型逐步遞進,可以根據需要使用。

而hive向量化模式可以極大程度的優化hive執行速度。

4.hive向量化模式優化執行比對

例7 執行優化速度比對。

-- 代碼1 開啟向量化模式
set hive.vectorized.execution.enabled = true;
select age,count(0) as num from temp.user_info_all where ymd = '20230505'
and age < 30 and nick like '%小%'
group by age;

-- 代碼2 關閉向量化模式
set hive.vectorized.execution.enabled = false;
select age,count(0) as num from temp.user_info_all where ymd = '20230505'
and age < 30 and nick like '%小%'
group by age;

執行結果:

# 代碼1執行結果開啟向量化模式
MapReduce Total cumulative CPU time: 1 minutes 1 seconds 740 msec
Ended Job = job_1675664438694_13647623
MapReduce Jobs Launched: 
Stage-Stage-1: Map: 6  Reduce: 5   Cumulative CPU: 61.74 sec   HDFS Read: 367242142 HDFS Write: 1272 SUCCESS
Total MapReduce CPU Time Spent: 1 minutes 1 seconds 740 msec
OK
15      23
... # 省略數據
29      81849
Time taken: 41.322 seconds, Fetched: 31 row(s)

# 代碼2執行結果關閉向量化模式
MapReduce Total cumulative CPU time: 1 minutes 39 seconds 190 msec
Ended Job = job_1675664438694_13647754
MapReduce Jobs Launched: 
Stage-Stage-1: Map: 6  Reduce: 5   Cumulative CPU: 99.19 sec   HDFS Read: 367226626 HDFS Write: 1272 SUCCESS
Total MapReduce CPU Time Spent: 1 minutes 39 seconds 190 msec
OK
15      23
... # 省略數據
29      81849
Time taken: 50.724 seconds, Fetched: 31 row(s)

以上結果可以看出,開啟向量化模式執行結果查詢耗時減少,雖然減少的不多,但在CPU使用上少了三分之一的資源。可見開啟向量化模式不僅可以提高查詢速度,還可以節省查詢資源。

以上開啟向量化模式為mr引擎測試結果,tez和spark還具有更優的執行表現。

下一期:Hive執行計劃之只有map階段SQL性能分析和解讀

按例,歡迎點擊此處關註我的個人公眾號,交流更多知識。

後臺回覆關鍵字 hive,隨機贈送一本魯邊備註版珍藏大數據書籍。


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

-Advertisement-
Play Games
更多相關文章
  • # 一個超級大的文件如何更快讀 問題起因 ![](https://img2023.cnblogs.com/blog/2415052/202306/2415052-20230608110517159-989018809.png) 一個有千萬的數據的txt文件如何發揮IO的全部性能更快的讀和寫。 ## ...
  • 為什麼選擇FFmpeg? 延遲低,參數可控,相關函數方便查詢,是選擇FFmpeg作為編解碼器最主要原因,如果是處理實時流,要求低延遲,最好選擇是FFmpeg。 如果需要用Opencv或者C#的Emgucv這種庫來處理視頻流,也多是用FFmpeg做編解碼然後再轉換圖像數據給Opencv去處理。用Ope ...
  • 經過前幾篇文章的講解,初步瞭解ASP.NET Core MVC項目創建,啟動運行,以及命名約定,創建控制器,視圖,模型,接收參數,傳遞數據ViewData,ViewBag,路由,頁面佈局,wwwroot和客戶端庫,Razor語法,EnityFrameworkCore與資料庫,HttpContext,... ...
  • 大家好,我是 god23bin。今天給大家帶來的是 Linux 命令系列,**每天只需一分鐘,記住一個 Linux 命令不成問題**。今天,我們要介紹的是一個常用且強大的命令:tar。 ...
  • 目錄 一、awk概念 二、awk的工作過程 三、awk字元 四、內置變數 五、getline 六、awk的精準篩選 七、例子演示 八、實驗演示 一、awk概念 1.概念:awk 是一個功能強大的編輯工具,逐行讀取輸入文本,主要作用於文件內容,AWK信息的讀入也是逐行指定的匹配模式進行查找, 對符合條 ...
  • 本篇首先介紹下EXTI的結構,接著介紹外部中斷的相關概念,對STM32的IO外部中斷EXTI有個初步的瞭解,在此基礎上重點圍繞IO外部中斷EXTI的使用展開分析。 ...
  • [TOC](【後端面經-資料庫】MySQL的存儲引擎簡介) # MySQL的存儲引擎 mysql主要有四類存儲引擎,目前主要使用InnoDB作為存儲引擎。 ## 0. 存儲引擎的查看和修改 - 查看當前資料庫的預設存儲引擎 ```sql show variables like 'default_st ...
  • 標準隔離級別 讀未提交、讀已提交、可重覆讀、串列化 串列化 對事務中所有讀寫的數據加上讀鎖、寫鎖、範圍鎖。所以衝突的事務必須同步執行。 //console1 start transaction ; select * from transaction_test where `key`=1; updat ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...