主頁 > 資料庫 > 什么是hive的高級分組聚合,它的用法和注意事項以及性能分析

什么是hive的高級分組聚合,它的用法和注意事項以及性能分析

2023-06-30 08:39:05 資料庫

hive的高級分組聚合是指在聚合時使用GROUPING SETS、CUBE和ROLLUP的分組聚合,

高級分組聚合在很多資料庫類SQL中都有出現,并非hive獨有,這里只說明hive中的情況,

使用高級分組聚合不僅可以簡化SQL陳述句,而且通常情況下會提升SQL陳述句的性能,

1.Grouping sets 的使用

示例:

-- 使用方式
select a,b,sum(c) from tbl group by a,b grouping sets(a,b)

Grouping sets的子句允許在一個group by 陳述句中,指定多個分組聚合列,所有含有Grouping sets 的子句都可以用union連接的多個group by 查詢邏輯來表示,

如下一些常見的等價替換示例:

-- 陳述句1
select a, b sum(c) from tbl group by a,b grouping sets((a,b))
-- 相當于 
select a,b,sum(c) from tbl group by a,b

-- 陳述句2
select a,b,sum(c) from tbl group by a,b grouping sets((a,b),a)
-- 相當于
select a,b,sum(c) from tbl group by a,b
union
select a,null ,sum(c) from tbl group by a

-- 陳述句3
select a,b,sum(c) from tbl group by a,b grouping sets(a,b)
-- 相當于
select a,null,sum(c) from tbl group by a
union
select null ,b,sum(c) from tbl group by b

-- 陳述句4
select a,b,sum(c) from tbl group by a,b grouping sets((a,b),a,b,())
-- 相當于
select a,b,sum(c) from tbl group by a,b
union
select a,null,sum(c) from tbl group by a
union
select null,b,sum(c) from tbl group by b
union
select null,null,sum(c) from tbl

可以看到通過等價替換的改寫之后,陳述句會變得簡潔,性能我們之后分析,

2.cube 和rollup的使用

示例:

-- cube使用示例
select a,b,c,count(1) from tbl group by a,b,c with cube
-- rollup使用示例
select a,b,c,count(1) from tbl group by a,b,c with rollup

用法說明:

以上兩個高級分組函式都可以在一個group by 陳述句中完成多個分組聚合,它們都可以用grouping sets來等價替換,

  • cube 會計算所有group by 列的所有組合
-- cube陳述句
select a,b,c,count(1) from tbl group by a,b,c with cube
-- 相當于
select a,b,c count(1) from tbl group by a,b,c
grouping sets((a,b,c),(a,b),(b,c),(a,c),(a),(b),(c),())
  • rollup 會按照group by 指定的列從左到右進行分組聚合
-- rollup陳述句 滾動式聚合
select a,b,c,count(1) from tbl group by a,b,c with rollup
-- 相當于
select a,b,c,count(1) from tbl group by a,b,c s
grouping sets((a,b,c),(a,b),(a),())

3.使用高級分組聚合函式的性能分析

我們可以通過執行計劃的執行來分析高級分組聚合SQL陳述句的執行程序,比對其優化的節點,

例1 含grouping sets關鍵詞的SQL執行案例,

set hive.map.aggr=true;
explain
-- 小于30歲人群的不同性別平均年齡
select gender,avg(age) as avg_age from temp.user_info_all where ymd = '20230505'
and age < 30 
group by gender;

-- 將以上陳述句改為grouping sets關鍵詞執行陳述句
set hive.map.aggr=true;
explain
select gender,avg(age) as num from temp.user_info_all 
where ymd = '20230505'
and age < 30 
group by gender grouping sets((gender));

查看其執行計劃:

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) (type: boolean)
              Statistics: Num rows: 10878098 Data size: 261074352 Basic stats: COMPLETE Column stats: NONE
              Group By Operator
                aggregations: avg(age)
                keys: gender (type: int), 0 (type: int)
                mode: hash
                outputColumnNames: _col0, _col1, _col2
                Statistics: Num rows: 10878098 Data size: 261074352 Basic stats: COMPLETE Column stats: NONE
                Reduce Output Operator
                  key expressions: _col0 (type: int), _col1 (type: int)
                  sort order: ++
                  Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
                  Statistics: Num rows: 10878098 Data size: 261074352 Basic stats: COMPLETE Column stats: NONE
                  value expressions: _col2 (type: struct<count:bigint,sum:double,input:bigint>)
      Reduce Operator Tree:
        Group By Operator
          aggregations: avg(VALUE._col0)
          keys: KEY._col0 (type: int), KEY._col1 (type: int)
          mode: mergepartial
          outputColumnNames: _col0, _col2
          Statistics: Num rows: 5439049 Data size: 130537176 Basic stats: COMPLETE Column stats: NONE
          pruneGroupingSetId: true
          Select Operator
            expressions: _col0 (type: int), _col2 (type: double)
            outputColumnNames: _col0, _col1
            Statistics: Num rows: 5439049 Data size: 130537176 Basic stats: COMPLETE Column stats: NONE
            File Output Operator
              compressed: true
              Statistics: Num rows: 5439049 Data size: 130537176 Basic stats: COMPLETE Column stats: NONE
              table:
                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe

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

對以上內容進行關鍵字解讀:

map階段:

  • Group By Operator :Map端開啟聚合操作
  • aggregations:分組聚合的演算法,該案例采取avg(age)
  • keys: 這里是分組列+ 一個固定列 0
  • mode:Hash
  • outputColumnNames:最終輸出三列,_col0, _col1, _col2
  • Reduce Output Operator:該階段為map階段聚合后的操作
  • key expressions:map端最終輸出的key,該例為gender和0兩列,
  • sort order:輸出兩列都正序排序
  • Map-reduce partition columns:表示Map階段資料輸出的磁區列,該案例為gender和0兩列進行磁區,
  • value expressions:map端最終輸出value,為一個結構體,

Reduce階段:

  • Group By Operator:reduce階段的分組聚合操作,
  • aggregations: 分組聚合演算法,avg(VALUE._col0)表示對map階段輸出的 value expressions的 _col0取平均值,
  • keys:指定分組聚合的key,有兩列,為map階段輸出的key,
  • mode: mergepartial
  • outputColumnNames: 表示最終輸出的列,該例為gender和num,
  • pruneGroupingSetId: 表示是否對最終輸出的grouping id進行修剪,如果為true,則表示將keys最后一列拋棄,案例中為0列,
  • Select Operator:進行列投影操作,
  • expressions:輸出的列,gender和num,

通過查看以上的執行計劃,可以看出在使用含有grouping sets陳述句的SQL中,hive執行計劃并沒有給出具體的實作細節,

再執行具有多個聚合列的實體來看看:

例2 聚合年齡和聚合性別多列合并測驗,

set hive.map.aggr=true;
explain
select gender,age,count(0) as num from temp.user_info_all 
where ymd = '20230505'
and age < 30 
group by gender,age grouping sets(gender,age);

注:grouping sets后進行分組的列一定要在之前的group by中進行申明,

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) (type: boolean)
              Statistics: Num rows: 10878098 Data size: 261074352 Basic stats: COMPLETE Column stats: NONE
              Group By Operator
                aggregations: count(0)
                keys: gender (type: int), age (type: bigint), 0 (type: int)
                mode: hash
                outputColumnNames: _col0, _col1, _col2, _col3
                Statistics: Num rows: 21756196 Data size: 522148704 Basic stats: COMPLETE Column stats: NONE
                Reduce Output Operator
                  key expressions: _col0 (type: int), _col1 (type: bigint), _col2 (type: int)
                  sort order: +++
                  Map-reduce partition columns: _col0 (type: int), _col1 (type: bigint), _col2 (type: int)
                  Statistics: Num rows: 21756196 Data size: 522148704 Basic stats: COMPLETE Column stats: NONE
                  value expressions: _col3 (type: bigint)
      Reduce Operator Tree:
        Group By Operator
          aggregations: count(VALUE._col0)
          keys: KEY._col0 (type: int), KEY._col1 (type: bigint), KEY._col2 (type: int)
          mode: mergepartial
          outputColumnNames: _col0, _col1, _col3
          Statistics: Num rows: 10878098 Data size: 261074352 Basic stats: COMPLETE Column stats: NONE
          pruneGroupingSetId: true
          Select Operator
            expressions: _col0 (type: int), _col1 (type: bigint), _col3 (type: bigint)
            outputColumnNames: _col0, _col1, _col2
            Statistics: Num rows: 10878098 Data size: 261074352 Basic stats: COMPLETE Column stats: NONE
            File Output Operator
              compressed: true
              Statistics: Num rows: 10878098 Data size: 261074352 Basic stats: COMPLETE Column stats: NONE
              table:
                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe

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

通過以上兩個例子可以看出hive執行計劃中沒有具體的高級分組聚合如何實作分組方案,兩者執行方式基本上差不多,

在資料掃描和查詢上的確減少了多次資料掃描和資料io操作,在一定程度上節省了計算資源,

例3 使用cube替代grouping sets ,

set hive.map.aggr=true;
explain
select gender,age,count(0) as num from temp.user_info_all 
where ymd = '20230505'
and age < 30 
group by gender,age with cube;

-- 等價陳述句
select gender,age,count(0) as num from temp.user_info_all 
where ymd = '20230505'
and age < 30 
group by gender,age grouping sets((gender,age),(gender),(age),());
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) (type: boolean)
              Statistics: Num rows: 10878098 Data size: 261074352 Basic stats: COMPLETE Column stats: NONE
              Group By Operator
                aggregations: count(0)
                keys: gender (type: int), age (type: bigint), 0 (type: int)
                mode: hash
                outputColumnNames: _col0, _col1, _col2, _col3
                Statistics: Num rows: 43512392 Data size: 1044297408 Basic stats: COMPLETE Column stats: NONE
                Reduce Output Operator
                  key expressions: _col0 (type: int), _col1 (type: bigint), _col2 (type: int)
                  sort order: +++
                  Map-reduce partition columns: _col0 (type: int), _col1 (type: bigint), _col2 (type: int)
                  Statistics: Num rows: 43512392 Data size: 1044297408 Basic stats: COMPLETE Column stats: NONE
                  value expressions: _col3 (type: bigint)
      Reduce Operator Tree:
        Group By Operator
          aggregations: count(VALUE._col0)
          keys: KEY._col0 (type: int), KEY._col1 (type: bigint), KEY._col2 (type: int)
          mode: mergepartial
          outputColumnNames: _col0, _col1, _col3
          Statistics: Num rows: 21756196 Data size: 522148704 Basic stats: COMPLETE Column stats: NONE
          pruneGroupingSetId: true
          Select Operator
            expressions: _col0 (type: int), _col1 (type: bigint), _col3 (type: bigint)
            outputColumnNames: _col0, _col1, _col2
            Statistics: Num rows: 21756196 Data size: 522148704 Basic stats: COMPLETE Column stats: NONE
            File Output Operator
              compressed: true
              Statistics: Num rows: 21756196 Data size: 522148704 Basic stats: COMPLETE Column stats: NONE
              table:
                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe

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

以上例3 cube陳述句和例2陳述句輸出資料完全是不一樣的,但其輸出執行計劃內容基本和例2一致,可以看出hive的執行計劃對高級分組聚合拆分執行計劃的支持還不是很好,

使用高級分組聚合,要注意開啟map端聚合模式,

使用高級分組聚合,如上案例,僅使用一個作業就能夠實作union寫法需要多個作業才能實作的邏輯,

從這點上來看能夠減少多個作業在磁盤和網路I/O時的負擔,是一種優化,

但是同時也要注意因過度使用高級分組聚合陳述句而導致的資料急速膨脹問題,

  • 通常使用簡單的group by 陳述句,一份資料只有一種聚合結果,一個分組聚合通常只有一個記錄;

  • 使用高級分組聚合,例如cube,在一個作業中一份資料會存在多種聚合情況,最終輸出是,每種聚合情況各自對應一條資料,

注意事項:

如果使用高級分組聚合的陳述句處理的底表,在資料量很大的情況下容易導致Map或者Reduce任務因硬體資源不足而崩潰,

hive中使用hive.new.job.grouping.set.cardinality 配置項來應對以上情況,

如果SQL陳述句中處理分組聚合情況超過該配置項指定的值,默認值為(30),則會創建一個新的作業,

下一期:hive視窗分析函式解讀以及帶視窗分析函式的SQL性能分析

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

后臺回復關鍵字 hive,隨機贈送一本魯邊備注版珍藏大資料書籍,

轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/556376.html

標籤:其他

上一篇:高可用只讀,讓RDS for MySQL更穩定

下一篇:返回列表

標籤雲
其他(161899) Python(38266) JavaScript(25517) Java(18284) C(15238) 區塊鏈(8274) C#(7972) AI(7469) 爪哇(7425) MySQL(7278) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5876) 数组(5741) R(5409) Linux(5347) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4609) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2438) ASP.NET(2404) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) .NET技术(1985) HtmlCss(1979) 功能(1967) Web開發(1951) C++(1942) python-3.x(1918) 弹簧靴(1913) xml(1889) PostgreSQL(1881) .NETCore(1863) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • GPU虛擬機創建時間深度優化

    **?桔妹導讀:**GPU虛擬機實體創建速度慢是公有云面臨的普遍問題,由于通常情況下創建虛擬機屬于低頻操作而未引起業界的重視,實際生產中還是存在對GPU實體創建時間有苛刻要求的業務場景。本文將介紹滴滴云在解決該問題時的思路、方法、并展示最終的優化成果。 從公有云服務商那里購買過虛擬主機的資深用戶,一 ......

    uj5u.com 2020-09-10 06:09:13 more
  • 可編程網卡芯片在滴滴云網路的應用實踐

    **?桔妹導讀:**隨著云規模不斷擴大以及業務層面對延遲、帶寬的要求越來越高,采用DPDK 加速網路報文處理的方式在橫向縱向擴展都出現了局限性。可編程芯片成為業界熱點。本文主要講述了可編程網卡芯片在滴滴云網路中的應用實踐,遇到的問題、帶來的收益以及開源社區貢獻。 #1. 資料中心面臨的問題 隨著滴滴 ......

    uj5u.com 2020-09-10 06:10:21 more
  • 滴滴資料通道服務演進之路

    **?桔妹導讀:**滴滴資料通道引擎承載著全公司的資料同步,為下游實時和離線場景提供了必不可少的源資料。隨著任務量的不斷增加,資料通道的整體架構也隨之發生改變。本文介紹了滴滴資料通道的發展歷程,遇到的問題以及今后的規劃。 #1. 背景 資料,對于任何一家互聯網公司來說都是非常重要的資產,公司的大資料 ......

    uj5u.com 2020-09-10 06:11:05 more
  • 滴滴AI Labs斬獲國際機器翻譯大賽中譯英方向世界第三

    **桔妹導讀:**深耕人工智能領域,致力于探索AI讓出行更美好的滴滴AI Labs再次斬獲國際大獎,這次獲獎的專案是什么呢?一起來看看詳細報道吧! 近日,由國際計算語言學協會ACL(The Association for Computational Linguistics)舉辦的世界最具影響力的機器 ......

    uj5u.com 2020-09-10 06:11:29 more
  • MPP (Massively Parallel Processing)大規模并行處理

    1、什么是mpp? MPP (Massively Parallel Processing),即大規模并行處理,在資料庫非共享集群中,每個節點都有獨立的磁盤存盤系統和記憶體系統,業務資料根據資料庫模型和應用特點劃分到各個節點上,每臺資料節點通過專用網路或者商業通用網路互相連接,彼此協同計算,作為整體提供 ......

    uj5u.com 2020-09-10 06:11:41 more
  • 滴滴資料倉庫指標體系建設實踐

    **桔妹導讀:**指標體系是什么?如何使用OSM模型和AARRR模型搭建指標體系?如何統一流程、規范化、工具化管理指標體系?本文會對建設的方法論結合滴滴資料指標體系建設實踐進行解答分析。 #1. 什么是指標體系 ##1.1 指標體系定義 指標體系是將零散單點的具有相互聯系的指標,系統化的組織起來,通 ......

    uj5u.com 2020-09-10 06:12:52 more
  • 單表千萬行資料庫 LIKE 搜索優化手記

    我們經常在資料庫中使用 LIKE 運算子來完成對資料的模糊搜索,LIKE 運算子用于在 WHERE 子句中搜索列中的指定模式。 如果需要查找客戶表中所有姓氏是“張”的資料,可以使用下面的 SQL 陳述句: SELECT * FROM Customer WHERE Name LIKE '張%' 如果需要 ......

    uj5u.com 2020-09-10 06:13:25 more
  • 滴滴Ceph分布式存盤系統優化之鎖優化

    **桔妹導讀:**Ceph是國際知名的開源分布式存盤系統,在工業界和學術界都有著重要的影響。Ceph的架構和演算法設計發表在國際系統領域頂級會議OSDI、SOSP、SC等上。Ceph社區得到Red Hat、SUSE、Intel等大公司的大力支持。Ceph是國際云計算領域應用最廣泛的開源分布式存盤系統, ......

    uj5u.com 2020-09-10 06:14:51 more
  • es~通過ElasticsearchTemplate進行聚合~嵌套聚合

    之前寫過《es~通過ElasticsearchTemplate進行聚合操作》的文章,這一次主要寫一個嵌套的聚合,例如先對sex集合,再對desc聚合,最后再對age求和,共三層嵌套。 Aggregations的部分特性類似于SQL語言中的group by,avg,sum等函式,Aggregation ......

    uj5u.com 2020-09-10 06:14:59 more
  • 爬蟲日志監控 -- Elastc Stack(ELK)部署

    傻瓜式部署,只需替換IP與用戶 導讀: 現ELK四大組件分別為:Elasticsearch(核心)、logstash(處理)、filebeat(采集)、kibana(可視化) 下載均在https://www.elastic.co/cn/downloads/下tar包,各組件版本最好一致,配合fdm會 ......

    uj5u.com 2020-09-10 06:15:05 more
最新发布
  • 什么是hive的高級分組聚合,它的用法和注意事項以及性能分析

    hive的高級分組聚合是指在聚合時使用GROUPING SETS、CUBE和ROLLUP的分組聚合。 高級分組聚合在很多資料庫類SQL中都有出現,并非hive獨有,這里只說明hive中的情況。 使用高級分組聚合不僅可以簡化SQL陳述句,而且通常情況下會提升SQL陳述句的性能。 ## 1.Grouping ......

    uj5u.com 2023-06-30 08:39:05 more
  • 高可用只讀,讓RDS for MySQL更穩定

    摘要:業務應用對資料庫的資料請求分寫請求(增刪改)和讀請求(查)。當存在大量讀請求時,為避免讀請求阻塞寫請求,資料庫會提供只讀實體方案。通過主實體+N只讀實體的方式,實作讀寫分離,滿足大量的資料庫讀取需求,增加應用的吞吐量。 業務應用對資料庫的資料請求分寫請求(增刪改)和讀請求(查)。當存在大量讀請 ......

    uj5u.com 2023-06-30 08:38:47 more
  • 構建數字工廠丨資料分析與圖表視圖模型的配置用法

    摘要:本期結合示例,詳細介紹華為云數字工廠平臺的資料分析模型和資料圖表視圖模型的配置用法。 本文分享自華為云社區《數字工廠深入淺出系列(六):資料分析與圖表視圖模型的配置用法》,作者:云起MAE 。 華為云數字工廠平臺基于“資料與業務一體化”理念,提供統一的制造全域資料平臺底座,內置輕量級制造資料分 ......

    uj5u.com 2023-06-30 08:38:06 more
  • 券商數字化創新場景資料中臺實踐

    時下,眾多金融機構在積極推行數字化改革,以適應時代高速革新。為回應市場對資訊即時生效的迫切需求,各家[券商機構](https://www.dtstack.com/solution/securities?src=https://www.cnblogs.com/DTinsight/archive/2023/06/29/szsm)都需要更具競爭力的資訊服務。 本次方案結合券商場景與業務實踐,圍繞客戶實際面臨的 ......

    uj5u.com 2023-06-30 08:37:39 more
  • 數字先鋒|云上醫院長什么樣?寧夏固原中醫醫院帶你一探究竟!

    衛健行業是關乎國家和民生安全的關鍵行業。近年來,云計算、大資料、人工智能等技術不斷發展,并與醫療行業深入融合。同時,相關部門相繼頒發一系列政策,進一步推動醫療行業數字化、智慧化轉型,促進探索健康中國高質量發展道路。 ......

    uj5u.com 2023-06-30 08:37:16 more
  • MySQL 8.0.33 my.ini說明

    #其他默認調整值#MySQL Server實體組態檔# #由MySQL Server實體配置向導生成###安裝說明# ##在Linux上,您可以將此檔案復制到/etc/my.cnf以設定全域選項,#mysql-data-dir/my.cnf設定服務器特定選項(用于此安裝的@localstatedi ......

    uj5u.com 2023-06-30 08:37:09 more
  • 面試官:講講MySql索引失效的幾種情況

    ## 索引失效 ### 準備資料: ```sql CREATE TABLE `dept` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `deptName` VARCHAR(30) DEFAULT NULL, `address` VARCHAR(40) DEFAUL ......

    uj5u.com 2023-06-30 08:36:54 more
  • 【技識訓累】Mysql中的SQL語言【一】

    博客推行版本更新,成果積累制度,已經寫過的博客還會再次更新,不斷地琢磨,高質量高數量都是要追求的,工匠精神是學習必不可少的精神。因此,大家有何建議歡迎在評論區踴躍發言,你們的支持是我最大的動力,你們敢投,我就敢肝 ......

    uj5u.com 2023-06-30 08:36:42 more
  • MySQL學習2--資料查詢

    一、基礎資料查詢 select陳述句用于從表中選取資料,結果被存盤在一個結果表中(稱為結果集)。 語法:select * from 表名稱 #查詢指定表中的所有資料 *為模糊匹配所有列 例: mysql> select * from person; + + + + + + + | id | name ......

    uj5u.com 2023-06-30 08:35:48 more
  • 高可用只讀,讓RDS for MySQL更穩定

    摘要:業務應用對資料庫的資料請求分寫請求(增刪改)和讀請求(查)。當存在大量讀請求時,為避免讀請求阻塞寫請求,資料庫會提供只讀實體方案。通過主實體+N只讀實體的方式,實作讀寫分離,滿足大量的資料庫讀取需求,增加應用的吞吐量。 業務應用對資料庫的資料請求分寫請求(增刪改)和讀請求(查)。當存在大量讀請 ......

    uj5u.com 2023-06-30 08:35:29 more