PostgreSQL Magazine 00 Chinese Edition
description
Transcript of PostgreSQL Magazine 00 Chinese Edition
![Page 1: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/1.jpg)
中文版由以下团队共同完成Postgres中文社区[email protected]北京神州立诚科技有限公司[email protected]
![Page 2: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/2.jpg)
About PGMagPostgreSQL Magazine is a media editedby and for the PostgreSQL Community.Editor : Damien ClochardWriters : Greg Smith, Frank Wiles, HubertLubaczewski, Jim Mlodgenski, Matt TescherReviewers :
Tools : Scribus 1.4 / Gimp 2.6Licence :The articles contained in this magazine arereleased under the Creative CommonsAttributionShare Alike 3.0 Unportedlicense. This means you can adapt, copy,distribute and transmit the articles butonly under the following conditions: Youmust attribute the work to the originalauthor in some way (at least a name,email or URL) and to this magazine byname ('postgresql magazine') and the URL(pgmag.org). You cannot attribute thearticle(s) in any way that suggests thatthey endorse you or your use of the work.If you alter, transform, or build upon thiswork, you must distribute the resultingwork under the same, similar or acompatible license.Disclaimer :PostgreSQL Magazine is an independentmedia. The views and opinions in themagazine should in no way be assumed tobe endorsed by the PostgreSQL GlobalDevelopment Group.This magazine is provided with absolutelyno warranty whatsoever; neither thecontributors nor PostgreSQL Magazineaccept any responsibility or liability for lossor damage resulting from readers choosingto apply this content to theirs or otherscomputers and equipment.Photo Credits :Front : © expressmonorail (flickr) ¹ / p4 :© Magnus Hagander / p5 : Vardion(wikipedia) / p6 : © lovelihood.com ² / p8: © Greg Stein / p11 : © ChristineMomjian / p13 : © dirkjankraan (flickr) ²/ p 17 : © Gage Skidmore (flickr) ² / p18 :© BULL / p19 : © Sebastiaan Zwarts(flickr) / p23 : © Geek and Poke ³¹ : Creative Commons BYNCSA² : Creative Commons BYSA³ : Creative Commons BYND
![Page 3: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/3.jpg)
![Page 4: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/4.jpg)
PGBR PostgreSQL
![Page 5: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/5.jpg)
![Page 6: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/6.jpg)
Cybertec Schönig & Schönig GmbH
![Page 7: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/7.jpg)
![Page 8: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/8.jpg)
![Page 9: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/9.jpg)
![Page 10: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/10.jpg)
![Page 11: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/11.jpg)
![Page 12: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/12.jpg)
![Page 13: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/13.jpg)
How To
![Page 14: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/14.jpg)
![Page 15: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/15.jpg)
The original presentation is availablehere : http://pgmag.org/0015
How To
![Page 16: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/16.jpg)
How To
/sbin/blockdev setra 4096 /dev/sda
![Page 17: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/17.jpg)
How To
echo 10 > /proc/sys/vm/dirty_ratioecho 5 > /proc/sys/vm/dirty_background_ratio
![Page 18: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/18.jpg)
![Page 19: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/19.jpg)
Use Case
![Page 20: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/20.jpg)
$ select '1.1'::ltree;ERROR: type "ltree" does not existLINE 1: select '1.1'::ltree;
^$ create EXTENSION ltree;CREATE EXTENSION$ select '1.1'::ltree;ltree1.1(1 row)
$ drop EXTENSION ltree;DROP EXTENSION
Core support for "extensions", which arepackages of SQL objects.
This patch adds the server infrastructure tosupport extensions. There is still onesignificant loose end, namely how to make itplay nice with pg_upgrade, so I am not yetcommitting the changes that would make allthe contrib modules depend on this feature.
In passing, fix a disturbingly large amountof breakage in AlterObjectNamespace() andcallers.
Dimitri Fontaine, reviewed by AnssiKääriäinen, Itagaki Takahiro, Tom Lane, andnumerous others
![Page 21: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/21.jpg)
$ create extension ltree;CREATE EXTENSION$ create table test (z ltree);CREATE TABLE
$ create schema ltree;CREATE SCHEMA$ alter extension ltree set schema ltree;ALTER EXTENSION
$ \d testTable "public.test"Column | Type | Modifiers++z | ltree.ltree |
# pg_dump | grep ltree Name: ltree; Type: SCHEMA; Schema: ;Owner: depeszCREATE SCHEMA ltree;ALTER SCHEMA ltree OWNER TO depesz; Name: ltree; Type: EXTENSION; Schema: ;Owner:CREATE EXTENSION ltree WITH SCHEMA ltree; Name: EXTENSION ltree; Type: COMMENT;Schema: ; Owner:COMMENT ON EXTENSION ltree IS 'data type forhierarchical treelike structures';z ltree.ltree
![Page 22: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/22.jpg)
![Page 23: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/23.jpg)
![Page 24: PostgreSQL Magazine 00 Chinese Edition](https://reader031.fdocuments.net/reader031/viewer/2022013122/568bf1911a28ab893393998f/html5/thumbnails/24.jpg)
yum install php
wget http://.../pgfouine1.2.tar.gztar zxvf pgfouine1.2.tar.gz
log_destination = 'stderr'redirect_stderr = onlog_line_prefix = '%t [%p]: [%l1] 'log_min_duration_statement = 0
sudo u postgres psqlselect pg_reload_conf();
select pg_rotate_logfile();
./pgfouine.php logtype stderr \file postgresql.log \> report.html