[英]insert values into temp tables very slow on bigquery
出於某種原因,BigQuery 將 6 行插入臨時表需要將近一分鍾的時間。 僅 null 值插入花費了 BQ 20 秒。
例子:
create temporary table units (
id string,
Nof_units int,
source_name string
);
insert into units values ('aFsd23j2', 45, 'a');
insert into units values ('aFsd23j2', 34, 'b');
insert into units values ('aFsd23j2', 12, 'c');
insert into units values ('r8cxn23n', 130, 'a');
insert into units values ('r8cxn23n', 139, 'b');
insert into units values ('r8cxn23n', null, 'c');
select *
from units
這背后的原因是什么?
基本上,像 BigQuery 這樣的 OLAP 數據庫並未針對變異查詢(即 INSERT、UPDATE、DELETE)進行優化。 如果減少插入語句的數量,它會比以前更快。
create temporary table units (
id string,
Nof_units int,
source_name string
);
insert into units values
('aFsd23j2', 45, 'a'),
('aFsd23j2', 34, 'b'),
('aFsd23j2', 12, 'c'),
('r8cxn23n', 130, 'a'),
('r8cxn23n', 139, 'b'),
('r8cxn23n', null, 'c');
select *
from units;
output:16.9 秒 --> 在我的環境中為 4.4 秒
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.