久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

怎么安裝和使用Greenplum開源的列式存儲(chǔ)zedstore

共計(jì) 4060 個(gè)字符,預(yù)計(jì)需要花費(fèi) 11 分鐘才能閱讀完成。

本篇內(nèi)容介紹了“怎么安裝和使用 Greenplum 開源的列式存儲(chǔ) zedstore”的有關(guān)知識(shí),在實(shí)際案例的操作過(guò)程中,不少人都會(huì)遇到這樣的困境,接下來(lái)就讓丸趣 TV 小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

安裝
從 Github 上下載源碼, 與普通 PG 一樣, 編譯安裝即可

[root@localhost postgres-zedstore]# ./configure --enable-debug --with-python --with-perl --with-tcl --with-gssapi --with-pam --with-openssl --with-pam --without-ldap --with-libxml --with-libxslt --enable-dtrace --enable-depend --enable-cassert --with-systemd CFLAGS= -O0 -DOPTIMIZER_DEBUG -g3 -gdwarf-2  --prefix=/appdb/zedstore
checking build system type... x86_64-pc-linux-gnu
[root@localhost postgres-zedstore]# make -j4
[root@localhost postgres-zedstore]# make install
PostgreSQL installation complete.

Heap vs ZedStore
創(chuàng)建用戶, 初始化數(shù)據(jù)庫(kù)

[zedstore@localhost ~]$ initdb -E utf8 -D /data/zedstore/testdb
The files belonging to this database system will be owned by user  zedstore .
This user must also own the server process.
The database cluster will be initialized with locale  en_US.UTF-8 .
The default text search configuration will be set to  english .
Data page checksums are disabled.
creating directory /data/zedstore/testdb ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... PRC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
initdb: warning: enabling  trust  authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
 pg_ctl -D /data/zedstore/testdb -l logfile start

下面來(lái)對(duì)比一下 head am 和 zedstore 的性能差異
Heap

testdb=# create table t_heap(id int,c1 int,c2 varchar(20));
CREATE TABLE 
testdb=# insert into t_heap select x,x, c2 ||x from generate_series(1,5000000) as x;
INSERT 0 5000000
testdb=#

執(zhí)行查詢

testdb=# explain analyze select avg(id),sum(c1),max(c2) from t_heap;
 QUERY PLAN 
------------------------------------------------------------------------------------------------------------------
----------------------------
 Finalize Aggregate (cost=69209.94..69209.95 rows=1 width=72) (actual time=964.313..964.314 rows=1 loops=1)
 -  Gather (cost=69209.71..69209.92 rows=2 width=72) (actual time=963.978..966.938 rows=3 loops=1)
 Workers Planned: 2
 Workers Launched: 2
 -  Partial Aggregate (cost=68209.71..68209.72 rows=1 width=72) (actual time=929.220..929.220 rows=1 loo
ps=3)
 -  Parallel Seq Scan on t_heap (cost=0.00..52584.55 rows=2083355 width=17) (actual time=0.094..25
6.014 rows=1666667 loops=3)
 Planning Time: 17.157 ms
 Execution Time: 968.461 ms
(8 rows)
testdb=#

執(zhí)行時(shí)間為 968ms

空間占用

testdb=# select pg_size_pretty(pg_table_size( t_heap 
 pg_size_pretty 
----------------
 248 MB
(1 row)

ZedStore

testdb=# create table t_zedstore(id int,c1 int,c2 varchar(20)) using zedstore;
CREATE TABLE 
testdb=# insert into t_zedstore select x,x, c2 ||x from generate_series(1,5000000) as x;
INSERT 0 5000000
testdb=#

執(zhí)行查詢

testdb=# explain analyze select avg(id),sum(c1),max(c2) from t_zedstore;
 QUERY PLAN 
------------------------------------------------------------------------------------------------------------------
-------------------------------
 Finalize Aggregate (cost=24917.50..24917.51 rows=1 width=72) (actual time=1341.238..1341.239 rows=1 loops=1)
 -  Gather (cost=24917.27..24917.48 rows=2 width=72) (actual time=1341.046..1343.387 rows=3 loops=1)
 Workers Planned: 2
 Workers Launched: 2
 -  Partial Aggregate (cost=23917.27..23917.28 rows=1 width=72) (actual time=1328.432..1328.432 rows=1 l
oops=3)
 -  Parallel Seq Scan on t_zedstore (cost=0.00..18968.87 rows=659787 width=17) (actual time=0.702.
.837.075 rows=1666667 loops=3)
 Planning Time: 0.643 ms
 Execution Time: 1343.612 ms
(8 rows)
testdb=#

使用 zedstore 的時(shí)間是 1343ms,比起 heap 方式要慢接近 40%。

空間占用

testdb=# select pg_size_pretty(pg_table_size( t_zedstore 
 pg_size_pretty 
----------------
 97 MB
(1 row)
testdb=#

不過(guò)使用 zedstore,空間占用倒是只有原來(lái)的 40% 左右。

“怎么安裝和使用 Greenplum 開源的列式存儲(chǔ) zedstore”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注丸趣 TV 網(wǎng)站,丸趣 TV 小編將為大家輸出更多高質(zhì)量的實(shí)用文章!

正文完
 
丸趣
版權(quán)聲明:本站原創(chuàng)文章,由 丸趣 2023-07-26發(fā)表,共計(jì)4060字。
轉(zhuǎn)載說(shuō)明:除特殊說(shuō)明外本站除技術(shù)相關(guān)以外文章皆由網(wǎng)絡(luò)搜集發(fā)布,轉(zhuǎn)載請(qǐng)注明出處。
評(píng)論(沒有評(píng)論)
主站蜘蛛池模板: 张北县| 浑源县| 金山区| 确山县| 天峨县| 龙海市| 镇雄县| 茌平县| 铜川市| 民县| 呼玛县| 布拖县| 榆社县| 化州市| 临漳县| 仁化县| 彭阳县| 承德县| 怀化市| 泾阳县| 新宁县| 崇义县| 罗江县| 儋州市| 上饶市| 玉林市| 化隆| 城固县| 安塞县| 墨竹工卡县| 鄂托克前旗| 临澧县| 巩留县| 金沙县| 万州区| 建瓯市| 凌源市| 大港区| 万州区| 丹阳市| 永城市|