PostgreSQL 11 preview - MERGE 语法支持与CTE内支持,兼容SQL:2016 , 兼容 Oracle

本文涉及的产品
RDS SQL Server Serverless,2-4RCU 50GB 3个月
推荐场景:
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS SQL Server,基础系列 2核4GB
简介:

标签

PostgreSQL , MERGE , CTE , trigger , rule


背景

PostgreSQL 11 支持了merge 语法,兼容SQL 2016标准。并且支持用于CTE语法中。

merge 语法常用于合并数据(将 某个源表、values表达式、QUERY、临时表等 合并到某个目标表中)。

例如,将源表的变更日志,合并到物化视图中。

PostgreSQL 除了使用insert into on conflict,如今又多了merge语法的支持(可以更好的支持OLAP的数据批量合并场景)。

语法

https://www.postgresql.org/docs/devel/static/sql-merge.html

[ WITH with_query [, ...] ]  
MERGE INTO target_table_name [ [ AS ] target_alias ]  
USING data_source  
ON join_condition  
when_clause [...]  
  
where data_source is  
  
{ source_table_name |  
  ( source_query )  
}  
[ [ AS ] source_alias ]  
  
and when_clause is  
  
{ WHEN MATCHED [ AND condition ] THEN { merge_update | merge_delete } |  
  WHEN NOT MATCHED [ AND condition ] THEN { merge_insert | DO NOTHING }  
}  
  
and merge_insert is  
  
INSERT [( column_name [, ...] )]  
[ OVERRIDING { SYSTEM | USER } VALUE ]  
{ VALUES ( { expression | DEFAULT } [, ...] ) | DEFAULT VALUES }  
  
and merge_update is  
  
UPDATE SET { column_name = { expression | DEFAULT } |  
             ( column_name [, ...] ) = ( { expression | DEFAULT } [, ...] )  
           } [, ...]  
  
and merge_delete is  
  
DELETE  

返回

MERGE total-count  

目标表触发器可能被触发

触发规则详见

https://www.postgresql.org/docs/devel/static/sql-merge.html

目标表规则不会被触发

如果JOIN过程中,匹配到多行,根据SQL标准定义来处理,目前是这样的,如果是更新的话,多行匹配(目标表的某单行,被源表或源数据的多行匹配到)会导致报错。

一些例子

1、Perform maintenance on CustomerAccounts based upon new Transactions.

MERGE INTO CustomerAccount CA  -- 目标表  
USING RecentTransactions T  -- 源可以是表、query、(values (),(),....) as alias表达式 等  
ON T.CustomerId = CA.CustomerId  -- JOIN 条件  
WHEN MATCHED THEN  -- 记录匹配,可以引用使用源于目标中的字段  
  UPDATE SET Balance = Balance + TransactionValue  
WHEN NOT MATCHED THEN  -- 记录未匹配,只能引用源字段  
  INSERT (CustomerId, Balance)  
  VALUES (T.CustomerId, T.TransactionValue);  

2、notice that this would be exactly equivalent to the following statement because the MATCHED result does not change during execution

MERGE INTO CustomerAccount CA  
USING (Select CustomerId, TransactionValue From RecentTransactions) AS T  
ON CA.CustomerId = T.CustomerId  
WHEN NOT MATCHED THEN  
  INSERT (CustomerId, Balance)  
  VALUES (T.CustomerId, T.TransactionValue)  
WHEN MATCHED THEN  
  UPDATE SET Balance = Balance + TransactionValue;  

3、Attempt to insert a new stock item along with the quantity of stock. If the item already exists, instead update the stock count of the existing item. Don't allow entries that have zero stock.

MERGE INTO wines w  
USING wine_stock_changes s  -- 源可以是临时表  
ON s.winename = w.winename  
WHEN NOT MATCHED AND s.stock_delta > 0 THEN  
  INSERT VALUES(s.winename, s.stock_delta)  
WHEN MATCHED AND w.stock + s.stock_delta > 0 THEN  
  UPDATE SET stock = w.stock + s.stock_delta;  
WHEN MATCHED THEN  
  DELETE;  

The wine_stock_changes table might be, for example, a temporary table recently loaded into the database.

4、回归测试中的例子

+-- WITH referenced by MERGE statement  
+CREATE TABLE m AS SELECT i AS k, (i || ' v')::text v FROM generate_series(1, 16, 3) i;  
+ALTER TABLE m ADD UNIQUE (k);  
+WITH RECURSIVE cte_basic AS (SELECT 1 a, 'cte_basic val' b)  
+MERGE INTO m USING (select 0 k, 'merge source SubPlan' v) o ON m.k=o.k  
+WHEN MATCHED THEN UPDATE SET v = (SELECT b || ' merge update' FROM cte_basic WHERE cte_basic.a = m.k LIMIT 1)  
+WHEN NOT MATCHED THEN INSERT VALUES(o.k, o.v);  
+ERROR:  WITH RECURSIVE is not supported for MERGE statement  
+-- Basic:  
+WITH cte_basic AS (SELECT 1 a, 'cte_basic val' b)  
+MERGE INTO m USING (select 0 k, 'merge source SubPlan' v) o ON m.k=o.k  
+WHEN MATCHED THEN UPDATE SET v = (SELECT b || ' merge update' FROM cte_basic WHERE cte_basic.a = m.k LIMIT 1)  
+WHEN NOT MATCHED THEN INSERT VALUES(o.k, o.v);  
+-- Examine  
+SELECT * FROM m where k = 0;  
+ k |          v             
+---+----------------------  
+ 0 | merge source SubPlan  
+(1 row)  
+  
+-- See EXPLAIN output for same query:  
+EXPLAIN (VERBOSE, COSTS OFF)  
+WITH cte_basic AS (SELECT 1 a, 'cte_basic val' b)  
+MERGE INTO m USING (select 0 k, 'merge source SubPlan' v) o ON m.k=o.k  
+WHEN MATCHED THEN UPDATE SET v = (SELECT b || ' merge update' FROM cte_basic WHERE cte_basic.a = m.k LIMIT 1)  
+WHEN NOT MATCHED THEN INSERT VALUES(o.k, o.v);  
+                            QUERY PLAN                               
+-------------------------------------------------------------------  
+ Merge on public.m  
+   CTE cte_basic  
+     ->  Result  
+           Output: 1, 'cte_basic val'::text  
+   ->  Hash Right Join  
+         Output: o.k, o.v, o.*, m_1.ctid  
+         Hash Cond: (m_1.k = o.k)  
+         ->  Seq Scan on public.m m_1  
+               Output: m_1.ctid, m_1.k  
+         ->  Hash  
+               Output: o.k, o.v, o.*  
+               ->  Subquery Scan on o  
+                     Output: o.k, o.v, o.*  
+                     ->  Result  
+                           Output: 0, 'merge source SubPlan'::text  
+   SubPlan 2  
+     ->  Limit  
+           Output: ((cte_basic.b || ' merge update'::text))  
+           ->  CTE Scan on cte_basic  
+                 Output: (cte_basic.b || ' merge update'::text)  
+                 Filter: (cte_basic.a = m.k)  
+(21 rows)  
+  
+-- InitPlan  
+WITH cte_init AS (SELECT 1 a, 'cte_init val' b)  
+MERGE INTO m USING (select 1 k, 'merge source InitPlan' v) o ON m.k=o.k  
+WHEN MATCHED THEN UPDATE SET v = (SELECT b || ' merge update' FROM cte_init WHERE a = 1 LIMIT 1)  
+WHEN NOT MATCHED THEN INSERT VALUES(o.k, o.v);  
+-- Examine  
+SELECT * FROM m where k = 1;  
+ k |             v               
+---+---------------------------  
+ 1 | cte_init val merge update  
+(1 row)  
+  
+-- See EXPLAIN output for same query:  
+EXPLAIN (VERBOSE, COSTS OFF)  
+WITH cte_init AS (SELECT 1 a, 'cte_init val' b)  
+MERGE INTO m USING (select 1 k, 'merge source InitPlan' v) o ON m.k=o.k  
+WHEN MATCHED THEN UPDATE SET v = (SELECT b || ' merge update' FROM cte_init WHERE a = 1 LIMIT 1)  
+WHEN NOT MATCHED THEN INSERT VALUES(o.k, o.v);  
+                             QUERY PLAN                               
+--------------------------------------------------------------------  
+ Merge on public.m  
+   CTE cte_init  
+     ->  Result  
+           Output: 1, 'cte_init val'::text  
+   InitPlan 2 (returns $1)  
+     ->  Limit  
+           Output: ((cte_init.b || ' merge update'::text))  
+           ->  CTE Scan on cte_init  
+                 Output: (cte_init.b || ' merge update'::text)  
+                 Filter: (cte_init.a = 1)  
+   ->  Hash Right Join  
+         Output: o.k, o.v, o.*, m_1.ctid  
+         Hash Cond: (m_1.k = o.k)  
+         ->  Seq Scan on public.m m_1  
+               Output: m_1.ctid, m_1.k  
+         ->  Hash  
+               Output: o.k, o.v, o.*  
+               ->  Subquery Scan on o  
+                     Output: o.k, o.v, o.*  
+                     ->  Result  
+                           Output: 1, 'merge source InitPlan'::text  
+(21 rows)  
+  
+-- MERGE source comes from CTE:  
+WITH merge_source_cte AS (SELECT 15 a, 'merge_source_cte val' b)  
+MERGE INTO m USING (select * from merge_source_cte) o ON m.k=o.a  
+WHEN MATCHED THEN UPDATE SET v = (SELECT b || merge_source_cte.*::text || ' merge update' FROM merge_source_cte WHERE a = 15)  
+WHEN NOT MATCHED THEN INSERT VALUES(o.a, o.b || (SELECT merge_source_cte.*::text || ' merge insert' FROM merge_source_cte));  
+-- Examine  
+SELECT * FROM m where k = 15;  
+ k  |                              v                                 
+----+--------------------------------------------------------------  
+ 15 | merge_source_cte val(15,"merge_source_cte val") merge insert  
+(1 row)  
+  
+-- See EXPLAIN output for same query:  
+EXPLAIN (VERBOSE, COSTS OFF)  
+WITH merge_source_cte AS (SELECT 15 a, 'merge_source_cte val' b)  
+MERGE INTO m USING (select * from merge_source_cte) o ON m.k=o.a  
+WHEN MATCHED THEN UPDATE SET v = (SELECT b || merge_source_cte.*::text || ' merge update' FROM merge_source_cte WHERE a = 15)  
+WHEN NOT MATCHED THEN INSERT VALUES(o.a, o.b || (SELECT merge_source_cte.*::text || ' merge insert' FROM merge_source_cte));  
+                                                  QUERY PLAN                                                     
+---------------------------------------------------------------------------------------------------------------  
+ Merge on public.m  
+   CTE merge_source_cte  
+     ->  Result  
+           Output: 15, 'merge_source_cte val'::text  
+   InitPlan 2 (returns $1)  
+     ->  CTE Scan on merge_source_cte merge_source_cte_1  
+           Output: ((merge_source_cte_1.b || (merge_source_cte_1.*)::text) || ' merge update'::text)  
+           Filter: (merge_source_cte_1.a = 15)  
+   InitPlan 3 (returns $2)  
+     ->  CTE Scan on merge_source_cte merge_source_cte_2  
+           Output: ((merge_source_cte_2.*)::text || ' merge insert'::text)  
+   ->  Hash Right Join  
+         Output: merge_source_cte.a, merge_source_cte.b, ROW(merge_source_cte.a, merge_source_cte.b), m_1.ctid  
+         Hash Cond: (m_1.k = merge_source_cte.a)  
+         ->  Seq Scan on public.m m_1  
+               Output: m_1.ctid, m_1.k  
+         ->  Hash  
+               Output: merge_source_cte.a, merge_source_cte.b  
+               ->  CTE Scan on merge_source_cte  
+                     Output: merge_source_cte.a, merge_source_cte.b  
+(20 rows)  
+  
+DROP TABLE m;  

5、个人测试例子

目标表触发器

create or replace function tg() returns trigger as $$  
declare  
begin  
  raise notice '%', new;  
  return null;  
end;  
$$ language plpgsql strict;  

目标表

create table t1(id int primary key, info text, crt_time timestamp);  

源表

create table t2(id int primary key, info text, crt_time timestamp);  

写入100条测试数据到源表

postgres=# insert into t2 select generate_series(1,100),random()*100, now();  
INSERT 0 100  

创建目标表触发器

postgres=# create trigger tg after insert on t1 for each row execute procedure tg();  
CREATE TRIGGER  

使用merge into,将源表数据合并到目标表,并触发了INSERT触发器

postgres=#   
merge into t1 using t2   
on t1.id=t2.id   
when not matched then insert (id,info,crt_time) values (t2.id,t2.info,t2.crt_time)   
when matched and t1.info<>t2.info or t1.crt_time<>t2.crt_time then update set info=t2.info , crt_time=t2.crt_time;  
  
NOTICE:  (1,29.9749359954149,"2018-04-07 22:03:31.531152")  
NOTICE:  (2,93.1852474343032,"2018-04-07 22:03:31.531152")  
NOTICE:  (3,25.758066913113,"2018-04-07 22:03:31.531152")  
NOTICE:  (4,69.128438225016,"2018-04-07 22:03:31.531152")  
NOTICE:  (5,34.7714505158365,"2018-04-07 22:03:31.531152")  
NOTICE:  (6,47.4942798726261,"2018-04-07 22:03:31.531152")  
NOTICE:  (7,61.8766254279763,"2018-04-07 22:03:31.531152")  
NOTICE:  (8,97.1885625738651,"2018-04-07 22:03:31.531152")  
NOTICE:  (9,7.41707538254559,"2018-04-07 22:03:31.531152")  
NOTICE:  (10,70.8636813331395,"2018-04-07 22:03:31.531152")  
NOTICE:  (11,33.8312264997512,"2018-04-07 22:03:31.531152")  
NOTICE:  (12,77.4763741064817,"2018-04-07 22:03:31.531152")  
NOTICE:  (13,5.14419632963836,"2018-04-07 22:03:31.531152")  
NOTICE:  (14,86.3092178478837,"2018-04-07 22:03:31.531152")  
NOTICE:  (15,41.1678662057966,"2018-04-07 22:03:31.531152")  
NOTICE:  (16,27.8295359108597,"2018-04-07 22:03:31.531152")  
NOTICE:  (17,77.8380565810949,"2018-04-07 22:03:31.531152")  
NOTICE:  (18,13.997572241351,"2018-04-07 22:03:31.531152")  
NOTICE:  (19,34.8465123679489,"2018-04-07 22:03:31.531152")  
NOTICE:  (20,26.4941859059036,"2018-04-07 22:03:31.531152")  
NOTICE:  (21,88.9189361128956,"2018-04-07 22:03:31.531152")  
NOTICE:  (22,21.6747588012367,"2018-04-07 22:03:31.531152")  
NOTICE:  (23,41.413659369573,"2018-04-07 22:03:31.531152")  
NOTICE:  (24,19.375761738047,"2018-04-07 22:03:31.531152")  
NOTICE:  (25,53.5534802824259,"2018-04-07 22:03:31.531152")  
NOTICE:  (26,82.7209649607539,"2018-04-07 22:03:31.531152")  
NOTICE:  (27,39.306652918458,"2018-04-07 22:03:31.531152")  
NOTICE:  (28,41.2743093911558,"2018-04-07 22:03:31.531152")  
NOTICE:  (29,79.2670299764723,"2018-04-07 22:03:31.531152")  
NOTICE:  (30,40.3565632645041,"2018-04-07 22:03:31.531152")  
NOTICE:  (31,54.4456570409238,"2018-04-07 22:03:31.531152")  
NOTICE:  (32,9.24196597188711,"2018-04-07 22:03:31.531152")  
NOTICE:  (33,33.5418107453734,"2018-04-07 22:03:31.531152")  
NOTICE:  (34,80.203724000603,"2018-04-07 22:03:31.531152")  
NOTICE:  (35,78.3704041969031,"2018-04-07 22:03:31.531152")  
NOTICE:  (36,68.3132612612098,"2018-04-07 22:03:31.531152")  
NOTICE:  (37,27.698003873229,"2018-04-07 22:03:31.531152")  
NOTICE:  (38,40.2470296714455,"2018-04-07 22:03:31.531152")  
NOTICE:  (39,65.5018238350749,"2018-04-07 22:03:31.531152")  
NOTICE:  (40,35.1150792557746,"2018-04-07 22:03:31.531152")  
NOTICE:  (41,11.110711004585,"2018-04-07 22:03:31.531152")  
NOTICE:  (42,99.3330503813922,"2018-04-07 22:03:31.531152")  
NOTICE:  (43,12.5914534088224,"2018-04-07 22:03:31.531152")  
NOTICE:  (44,16.2549073807895,"2018-04-07 22:03:31.531152")  
NOTICE:  (45,85.6422682292759,"2018-04-07 22:03:31.531152")  
NOTICE:  (46,53.759319614619,"2018-04-07 22:03:31.531152")  
NOTICE:  (47,44.0844432916492,"2018-04-07 22:03:31.531152")  
NOTICE:  (48,63.4803248103708,"2018-04-07 22:03:31.531152")  
NOTICE:  (49,67.75689185597,"2018-04-07 22:03:31.531152")  
NOTICE:  (50,78.9309556595981,"2018-04-07 22:03:31.531152")  
NOTICE:  (51,89.9745107628405,"2018-04-07 22:03:31.531152")  
NOTICE:  (52,56.6758279688656,"2018-04-07 22:03:31.531152")  
NOTICE:  (53,0.60571450740099,"2018-04-07 22:03:31.531152")  
NOTICE:  (54,31.3881701324135,"2018-04-07 22:03:31.531152")  
NOTICE:  (55,76.0515897534788,"2018-04-07 22:03:31.531152")  
NOTICE:  (56,54.1591947898269,"2018-04-07 22:03:31.531152")  
NOTICE:  (57,14.1091350931674,"2018-04-07 22:03:31.531152")  
NOTICE:  (58,15.3582426719368,"2018-04-07 22:03:31.531152")  
NOTICE:  (59,95.4335042275488,"2018-04-07 22:03:31.531152")  
NOTICE:  (60,93.3761650696397,"2018-04-07 22:03:31.531152")  
NOTICE:  (61,55.714805983007,"2018-04-07 22:03:31.531152")  
NOTICE:  (62,49.8791612684727,"2018-04-07 22:03:31.531152")  
NOTICE:  (63,2.61813104152679,"2018-04-07 22:03:31.531152")  
NOTICE:  (64,89.2566167283803,"2018-04-07 22:03:31.531152")  
NOTICE:  (65,30.0828852690756,"2018-04-07 22:03:31.531152")  
NOTICE:  (66,80.988535284996,"2018-04-07 22:03:31.531152")  
NOTICE:  (67,57.5698779895902,"2018-04-07 22:03:31.531152")  
NOTICE:  (68,57.7808891423047,"2018-04-07 22:03:31.531152")  
NOTICE:  (69,21.2355649564415,"2018-04-07 22:03:31.531152")  
NOTICE:  (70,23.0717018712312,"2018-04-07 22:03:31.531152")  
NOTICE:  (71,92.8959684446454,"2018-04-07 22:03:31.531152")  
NOTICE:  (72,32.3462759610265,"2018-04-07 22:03:31.531152")  
NOTICE:  (73,22.4047522526234,"2018-04-07 22:03:31.531152")  
NOTICE:  (74,5.48742185346782,"2018-04-07 22:03:31.531152")  
NOTICE:  (75,48.6011833418161,"2018-04-07 22:03:31.531152")  
NOTICE:  (76,8.04702048189938,"2018-04-07 22:03:31.531152")  
NOTICE:  (77,59.2467414680868,"2018-04-07 22:03:31.531152")  
NOTICE:  (78,92.6856266334653,"2018-04-07 22:03:31.531152")  
NOTICE:  (79,71.5273452922702,"2018-04-07 22:03:31.531152")  
NOTICE:  (80,27.003633370623,"2018-04-07 22:03:31.531152")  
NOTICE:  (81,71.6165823396295,"2018-04-07 22:03:31.531152")  
NOTICE:  (82,61.5018560551107,"2018-04-07 22:03:31.531152")  
NOTICE:  (83,83.6794613394886,"2018-04-07 22:03:31.531152")  
NOTICE:  (84,72.2222968470305,"2018-04-07 22:03:31.531152")  
NOTICE:  (85,92.8900261875242,"2018-04-07 22:03:31.531152")  
NOTICE:  (86,59.7310510929674,"2018-04-07 22:03:31.531152")  
NOTICE:  (87,26.3814916368574,"2018-04-07 22:03:31.531152")  
NOTICE:  (88,6.99916132725775,"2018-04-07 22:03:31.531152")  
NOTICE:  (89,75.0892938114703,"2018-04-07 22:03:31.531152")  
NOTICE:  (90,21.8149958644062,"2018-04-07 22:03:31.531152")  
NOTICE:  (91,0.375326396897435,"2018-04-07 22:03:31.531152")  
NOTICE:  (92,30.8040997944772,"2018-04-07 22:03:31.531152")  
NOTICE:  (93,71.694157179445,"2018-04-07 22:03:31.531152")  
NOTICE:  (94,2.99345748499036,"2018-04-07 22:03:31.531152")  
NOTICE:  (95,20.0607165228575,"2018-04-07 22:03:31.531152")  
NOTICE:  (96,1.77704244852066,"2018-04-07 22:03:31.531152")  
NOTICE:  (97,83.9819927699864,"2018-04-07 22:03:31.531152")  
NOTICE:  (98,77.6305945124477,"2018-04-07 22:03:31.531152")  
NOTICE:  (99,59.5579316373914,"2018-04-07 22:03:31.531152")  
NOTICE:  (100,5.21755772642791,"2018-04-07 22:03:31.531152")  
MERGE 100  

再次执行,由于设置了条件t1.info<>t2.info or t1.crt_time<>t2.crt_time才更新,所以MERGE 0条.

postgres=# merge into t1 using t2   
on t1.id=t2.id   
when not matched then insert (id,info,crt_time) values (t2.id,t2.info,t2.crt_time)   
when matched and t1.info<>t2.info or t1.crt_time<>t2.crt_time then update set info=t2.info , crt_time=t2.crt_time;  
MERGE 0  

把条件t1.info<>t2.info or t1.crt_time<>t2.crt_time去掉,MERGE了100条(update)

postgres=#   
merge into t1 using t2   
on t1.id=t2.id   
when not matched then insert (id,info,crt_time) values (t2.id,t2.info,t2.crt_time)   
when matched then update set info=t2.info , crt_time=t2.crt_time;  
MERGE 100  

目前merge into语法与rule不能同时使用,也就是说如果目标表上有insert\update\delete的RULE的话,不能使用merge into来合并数据到目标表。

postgres=# create rule r1 as on insert to t1 do instead nothing;
CREATE RULE

postgres=# insert into t1 values (0);
INSERT 0 0

postgres=# truncate t1;
TRUNCATE TABLE

postgres=# \set VERBOSITY verbose

postgres=# merge into t1 using t2 
on t1.id=t2.id 
when not matched then insert (id,info,crt_time) values (t2.id,t2.info,t2.crt_time) 
when matched and t1.info<>t2.info or t1.crt_time<>t2.crt_time then update set info=t2.info , crt_time=t2.crt_time;

ERROR:  0A000: MERGE is not supported for relations with rules
LOCATION:  transformMergeStmt, parse_merge.c:424

参考

https://www.postgresql.org/docs/devel/static/sql-merge.html

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=e6597dc3533946b98acba7871bd4ca1f7a3d4c1d

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=354f13855e6381d288dfaa52bcd4f2cb0fd4a5eb

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=7cf8a5c302735d193dcf901b87e03e324903c632

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=aa5877bb26347c58a34aee4e460eb1e1123bb096

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=d204ef63776b8a00ca220adec23979091564e465

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=83454e3c2b28141c0db01c7d2027e01040df5249

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=aa3faa3c7a7a49b3318059ccaf79bc1886a64707

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=4923550c20ae6d122ae0867480a7de8b040f7d80

相关实践学习
使用PolarDB和ECS搭建门户网站
本场景主要介绍基于PolarDB和ECS实现搭建门户网站。
阿里云数据库产品家族及特性
阿里云智能数据库产品团队一直致力于不断健全产品体系,提升产品性能,打磨产品功能,从而帮助客户实现更加极致的弹性能力、具备更强的扩展能力、并利用云设施进一步降低企业成本。以云原生+分布式为核心技术抓手,打造以自研的在线事务型(OLTP)数据库Polar DB和在线分析型(OLAP)数据库Analytic DB为代表的新一代企业级云原生数据库产品体系, 结合NoSQL数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
目录
相关文章
|
12天前
|
SQL 存储 关系型数据库
SQL `CREATE DATABASE` 语法
【11月更文挑战第10天】
34 3
|
17天前
|
SQL 关系型数据库 数据库
sql语法
【10月更文挑战第26天】sql语法
28 5
|
25天前
|
SQL 数据库
SQL数据库基础语法入门
[link](http://www.vvo.net.cn/post/082935.html)
|
2月前
|
Oracle NoSQL 关系型数据库
主流数据库对比:MySQL、PostgreSQL、Oracle和Redis的优缺点分析
主流数据库对比:MySQL、PostgreSQL、Oracle和Redis的优缺点分析
391 2
|
1月前
|
SQL 存储 关系型数据库
mysql SQL必知语法
本文详细介绍了MySQLSQL的基本语法,包括SELECT、FROM、WHERE、GROUPBY、HAVING、ORDERBY等关键字的使用,以及数据库操作如创建、删除表,数据类型,插入、查询、过滤、排序、连接和汇总数据的方法。通过学习这些内容,读者将能更好地管理和操
14 0
|
1月前
|
SQL 关系型数据库 MySQL
Mysql(2)—SQL语法详解
SQL(Structured Query Language,结构化查询语言)是一种用于管理关系型数据库的标准编程语言。它主要用于数据的查询、插入、更新和删除等操作。SQL最初在1970年代由IBM的研究人员开发,旨在处理关系数据模型。
29 0
|
3月前
|
SQL 关系型数据库 MySQL
INSERT INTO t_a.tableName SELECT * FROM t_b.tableName 如何通过定义一个list对象,包含多个tableName,循环执行前面的sql,用MySQL的语法写
【8月更文挑战第7天】INSERT INTO t_a.tableName SELECT * FROM t_b.tableName 如何通过定义一个list对象,包含多个tableName,循环执行前面的sql,用MySQL的语法写
41 5
|
4月前
|
SQL 关系型数据库 数据库
sql语法
【7月更文挑战第30天】sql语法
47 12
|
3月前
|
SQL 关系型数据库 MySQL
SQL Server、MySQL、PostgreSQL:主流数据库SQL语法异同比较——深入探讨数据类型、分页查询、表创建与数据插入、函数和索引等关键语法差异,为跨数据库开发提供实用指导
【8月更文挑战第31天】SQL Server、MySQL和PostgreSQL是当今最流行的关系型数据库管理系统,均使用SQL作为查询语言,但在语法和功能实现上存在差异。本文将比较它们在数据类型、分页查询、创建和插入数据以及函数和索引等方面的异同,帮助开发者更好地理解和使用这些数据库。尽管它们共用SQL语言,但每个系统都有独特的语法规则,了解这些差异有助于提升开发效率和项目成功率。
363 0
|
4月前
|
SQL 关系型数据库 分布式数据库
PolarDB产品使用问题之遇到SQL语法错误,该如何排查
PolarDB产品使用合集涵盖了从创建与管理、数据管理、性能优化与诊断、安全与合规到生态与集成、运维与支持等全方位的功能和服务,旨在帮助企业轻松构建高可用、高性能且易于管理的数据库环境,满足不同业务场景的需求。用户可以通过阿里云控制台、API、SDK等方式便捷地使用这些功能,实现数据库的高效运维与持续优化。

相关产品

  • 云原生数据库 PolarDB
  • 云数据库 RDS PostgreSQL 版