我親愛的朋友們,今天讓我們來討論下 PostgreSQL 以及該資料庫最有用的一些擴充。
PostgreSQL 是一個關係型資料庫管理系統,主要特點:
- 資料庫支援幾乎無限的大小;
- 強大而且可靠的事務複製機制
- 內建的可擴充程式設計語言
- 繼承
- 可通過一些向外延展群組件進行功能擴充
今天我們主要介紹最後一個特性,下面讓我們來看一些 PostgreSQL 的擴充。
PostGIS
PostGIS在對象關係型資料庫PostgreSQL上增加了儲存管理空間資料的能力,相當於Oracle的spatial部分。PostGIS最大的特點是符合并且實現了OpenGIS的一些規範,是最著名的開源GIS資料庫。
PostPic
PostPic 是 PostgreSQL 資料庫的擴充,用來在資料庫內進行影像處理,PostPic 為 SQL 增加了 image 類型,還包含很多相關的函數用來處理圖片以及從圖片中抽取對應的屬性。
PL/Proxy
PL/Proxy和PostgreSQL叢集的結構關係可以用清楚地表示
Texcaller
Texcaller 是 TeX 命令列工具的編程介面,採用純 C 編寫的可移植庫,無需外部依賴。
PgMemcache
PgMemcache 是一組 PostgreSQL 使用者自訂函數提供了訪問 memcached 快取服務器的介面。安裝 pgmemcache 很簡單,但需要一些額外的瑣碎要求:libmemcached 必須是 0.38 或者更新版本,PostgreSQL 必須是 8.4 或者更新版本。該擴充提供了 memcached 資料的讀寫、搜尋和刪除。
Prefix
http://pgfoundry.org/projects/prefix
prefix 模組實現了文本的首碼匹配操作,支援索引典型的寫法:
SELECT * FROM osc_prefixes WHERE prefix @> ’0123456789′ ORDER BY length(prefix::text) LIMIT 1
pgSphere
pgSphere 為 PostgreSQL 資料庫提供球面資料類型,函數,和運算函數。
Multicorn
Multicorn 是一個 PostgreSQL 9.1+ 的擴充模組,用於簡化外部資料封裝開發,允許開發人員使用 Python 程式設計語言開發。
- oracle_fdw – connects to Oracle databases.
- mysql_fdw – connects to MySQL databases.
- tds_fdw – connects to Sybase and Microsoft SQL Server databases.
- odbc_fdw – connects to any ODBC source.
- couchdb_fdw – connects to CouchDB databases.
- redis_fdw – connects to Redis databases.
- twitter_fdw – fetches messages from Twitter.
- ldap_fdw – queries LDAP servers.
- file_fdw – access data files in the server’s file system and query them as tables.
- file_fixed_length_record_fdw – reads flat files with columns of fixed width.
- PGStrom – uses GPU devices to accelerate sequential scan on massive amount of records with complex qualifiers.
- s3_fdw – reads files located in Amazon S3.
- www_fdw – accesses web services as a data source.
- multicorn.sqlalchemyfdw – used to access data stored in any database supported by the sqlalchemy python toolkit, such as MySQL, SQLite, Oracle, Microsoft SQL Server and many others.
- multicorn.fsfdw – used to access data stored in various files, in a filesystem.
- multicorn.csvfdw – used to access data stored in CSV files.
- multicorn.rssfdw – used to access items from an RSS feed.
Hstore
http://www.postgresql.org/docs/9.1/static/hstore.html
該模組為 PostgreSQL 提供儲存Key-Value資料的功能,你可以定義 hstore 資料列來儲存這樣的資料,並可對這些資料進行分組、排序和唯一檢索的查詢。
Intarray
http://www.postgresql.org/docs/9.1/static/intarray.html
intarray 模組提供一系列有用的函數和運算用於操作整數數組,同時支援索引搜尋。
如果數組中包含 null 元素,那麼所有的這些操作都將拋出錯誤。當我開發一個簡單的映像比較功能時,我會使用這個擴充 (http://leopard.in.ua/2010/12/09/bystroe-sravnenie-izobrazhenij-s-pomoshhyu-rubyphp-i-postgresql/, 俄文).
Dblink
http://www.postgresql.org/docs/9.1/static/dblink.html
Dblink 讓你可以在 PostgreSQL 串連會話中支援串連到其他 PG 資料庫,同時支援自主事務 autonomous transactions (like in Oracle).
That’s all folks!