目前postgresql的最新版本已經(jīng)是10.4 ;本次安裝的版本是9.6,大版本之間還是有很多新特性的。
1、postgresql9.6的新功能:
①:并行查詢
并行查詢是9.6版本的大亮點。在之前的版本中,即使擁有多個空閑處理器,但數(shù)據(jù)庫限制只能利用單個CPU的計算能力。9.6版本支持并行查詢操作,因此能夠利用服務器上的幾個或所有CPU內(nèi)核進行運算,這樣講更快返回查詢結(jié)果。目前支持并行特性的操作有順序表掃描、聚合和邊接,根據(jù)操作細節(jié)和可用內(nèi)核數(shù)目的不同,該并行特性可提高對大數(shù)據(jù)的檢索效率,最快時可高達32倍左右。
②:同步復制功能的改進:
postgresql的同步復制功能能得到改進,使它能夠用于數(shù)據(jù)庫集群一致讀取的維護。首先,它現(xiàn)在允許配置同步復制組,其次,“remote_apply”模式通過多重節(jié)點創(chuàng)建一個更具統(tǒng)一性的實例。這些特性支持使用內(nèi)置的自我復制功能來維護獨立節(jié)點的負載均衡。
③:短語搜索
postgresql的文本搜索功能,現(xiàn)在支持短語搜索。用戶可以搜索精確的某個短語或者搜索有一定相似性的短語。
使用快速的GIN索引中的單詞,結(jié)合可精細調(diào)整的文本搜索的新功能,postgresql已經(jīng)成為“混合搜索”的最佳選擇。
④:更好的鎖監(jiān)控
pg_stat_activity視圖提供了更加詳細的等待信息,當一個進程正在等待一個鎖時,用戶會看到鎖的類型,以及將查詢阻塞的等待事件的詳細信息。此外,postgresql還增加了pg_blocking_pids()函數(shù),可以知道哪些進程阻塞給定的服務器進程。
⑤:控制表膨脹
到目前為止,一個長時間運行的顯示查詢結(jié)果的報告或游標均可能阻止失效行的清理,從而使數(shù)據(jù)庫中經(jīng)常變化的表膨脹,導致數(shù)據(jù)庫的性能問題和存儲空間的過度使用。
9.6版本中添加了old_snapshot_threshold參數(shù),可以將集群配置為允許在更新或刪除事務時清除失效行,從而限制表膨脹。
此外,9.6版本還添加了其他功能,例如,支持級聯(lián)操作(需安裝擴展模塊實現(xiàn)),frozen頁面更好的空間回收機制,只掃描局部索引,支持命令執(zhí)行進度狀態(tài)報告,外部排序操作的性能改進等。
--下載PG二進制軟件包后,解壓:
[root@localhost ~]# tar -zxvf postgresql-9.6.9-1-linux-x64-binaries.tar.gz -C /usr/src/
[root@localhost ~]# groupadd pguser
[root@localhost ~]# useradd -g pguser pguser
[root@localhost ~]# passwd pguser
[root@localhost ~]# su - pguser
--初始化PG數(shù)據(jù)庫:
[pguser@localhost ~]$ cd /usr/src/pgsql/bin/ [pguser@localhost bin]$ ./initdb -E uft8 -D /pgsql/data/ The files belonging to this database system will be owned by user "pguser". This user must also own the server process. The database cluster will be initialized with locale "en_US.UTF-8". initdb: "uft8" is not a valid server encoding name [pguser@localhost bin]$ ./initdb -E utf8 -D /pgsql/data/ The files belonging to this database system will be owned by user "pguser". 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. fixing permissions on existing directory /pgsql/data ... ok creating subdirectories ... ok selecting default max_connections ... 100 selecting default shared_buffers ... 128MB selecting dynamic shared memory implementation ... posix creating configuration files ... ok running bootstrap script ... ok performing post-bootstrap initialization ... ok syncing data to disk ... ok 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 /pgsql/data/ -l logfile start --:配置環(huán)境變量,~/.bash_profile 添加如下內(nèi)容 PATH=/usr/local/pgsql/bin:$PATH export PATH --啟動數(shù)據(jù)庫: [pguser@localhost ~]$ source .bash_profile [pguser@localhost ~]$ pg_ctl -D /pgsql/data/ -l /home/pguser/postgres.log start server starting 或使用: ./postgres -D /pgsql/data > /pgsql/data/postgres.log &注意:
當安裝完數(shù)據(jù)庫后,我們會有一個系統(tǒng)用戶,一個數(shù)據(jù)庫,一個數(shù)據(jù)庫用戶,他們默認的名稱為:postgres
[root@localhost ~]# ps -ef |grep postgre
pguser 14160 1 0 01:36 pts/0 00:00:00 /usr/src/pgsql/bin/postgres -D /pgsql/data
pguser 14162 14160 0 01:36 ? 00:00:00 postgres: checkpointer process
pguser 14163 14160 0 01:36 ? 00:00:00 postgres: writer process
pguser 14164 14160 0 01:36 ? 00:00:00 postgres: wal writer process
pguser 14165 14160 0 01:36 ? 00:00:00 postgres: autovacuum launcher process
pguser 14166 14160 0 01:36 ? 00:00:00 postgres: stats collector process
pguser 14246 14160 0 01:42 ? 00:00:00 postgres: pguser testdb [local] idle
root 14256 14009 0 01:42 pts/1 00:00:00 grep --color=auto postgre
--連接測試:
[pguser@localhost ~]$ psql --list
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+--------+----------+-------------+-------------+-------------------
postgres | pguser | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | pguser | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/pguser +
| | | | | pguser=CTc/pguser
template1 | pguser | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/pguser +
| | | | | pguser=CTc/pguser
testdb | pguser | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
(4 rows)
--登錄數(shù)據(jù)庫(從上面查看得知 postgres是一個數(shù)據(jù)庫,)
[pguser@localhost ~]$ psql postgres
psql.bin (9.6.9)
Type "help" for help.
postgres=# select version();
version
----------------------------------------------------------------------------------------------------------
PostgreSQL 9.6.9 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16), 64-bit
(1 row)
postgres=#
postgres=# \q ---退出PG數(shù)據(jù)庫:
或者創(chuàng)建一個db:
[pguser@localhost ~]$ createdb testdb
[pguser@localhost ~]$ psql -d testdb ---登錄testdb
psql.bin (9.6.9)
Type "help" for help.
testdb=# select version();
version
----------------------------------------------------------------------------------------------------------
PostgreSQL 9.6.9 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16), 64-bit
(1 row)
testdb-# \q
pg_ctl -D /pgsql/data stop --關(guān)閉PG數(shù)據(jù)庫
注意:
pgadmin 是一個設計、維護和管理postgresql數(shù)據(jù)庫的通用工具,可以運行在Windows,Linux,freeBSD,mac,solaris平臺上。pgadmin工具簡單簡易直觀,可訪問、查詢、控制和管理數(shù)據(jù)庫,同時還對多樣化的圖形工具與多種功能齊全的腳本編輯器進行整合,極大方便了各種開發(fā)人員對postgresql的訪問。
另外有需要云服務器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。
新聞名稱:postgresql9.6安裝-創(chuàng)新互聯(lián)
網(wǎng)站URL:http://jinyejixie.com/article46/psseg.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設計、靜態(tài)網(wǎng)站、電子商務、服務器托管、品牌網(wǎng)站設計、移動網(wǎng)站建設
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容