Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

PostgreSQL 8.3 Update

2,011 views

Published on

PostgreSQL 8.3の新機能のうち、特にHOT更新による高速化について解説します。

Published in: Technology
  • Be the first to comment

  • Be the first to like this

PostgreSQL 8.3 Update

  1. 1. 2007.DB http://www.ospn.jp/osc2007.db/ PostgreSQL 8.3 Update 8.3 PostgreSQL / NTT OSS 2007.6.23 1
  2. 2. 8.1 8.3 autovacuum 8.1 fillfactor GIN 8.2 HOT XML autovacuum 8.3 2
  3. 3. 8.1 8.2 autovacuum 8.1 fillfactor GIN 8.2 HOT XML autovacuum 8.3 3
  4. 4. CPU バ TPC-C(OLTP) CPU ー 5 ジ 8.2 ョ 8.0 ン 8CPU ご 4 8.1 と 8.2 NUMA の 、 C 3 P U 1 個 2 8.1 SMP に 4CPU 対 (8CPU ) す 1 る 8.0 相 2CPU 対 性 0 能 1 2 4 8 12 16 20 24 28 32 core Scaling PostgreSQL on SMP Architectures Doug Tolbert (Unisys), PGCon 2007, Ottawa, 2007-05-24 4 http://www.pgcon.org/2007/schedule/events/16.en.html
  5. 5. • tsearch2 : SELECT isbn,title FROM books WHERE fts @@ to_tsquery(‘word1 & word2’); – GiST, GIN: 2 – , tsearch2 GiST GIN GiST 112ms 280ms 176s 146MB • → GiST GIN 39ms 3344ms 532s 306MB • → GIN ×0.35 ×11.94 ×3.02 ×2.10 • Full-Text Search in PostgreSQL Oleg Bartunov PGCon 2007, Ottawa, 2007/5/23 5 http://www.pgcon.org/2007/schedule/events/13.en.html
  6. 6. VACUUM • UPDATE – – VACUUM 6
  7. 7. PostgreSQL 8.3 1. – HOT OLTP 2. – 3. – WAL 4. VACUUM – VACUUM autovacuum 7
  8. 8. (1) 8.3 • HOT FillFactor Fill Factor TPS TPS – 280 – pgbench 260 40% 240 • 220 40%UP! – 200 – VACUUM • VACUUM 180 160 HOT • FillFactor 140 – 120 HOT – 100%( ) 100 90~95% 70 75 80 85 90 95 100 • ALTER TABLE name Fill Factor (%) SET (fillfactor=95); pgbench -s400 (5GB) NTT OSS Center 8
  9. 9. HOT (1) • 8.2 UPDATE ID 001 A 10 … 002 B 8→7 003 C 20 004 D 12 9
  10. 10. HOT (2) • 8.2 UPDATE ID 001 A 10 002 B 8 003 C 20 UPDATE 004 D 12 ×2 002 B 7 (CPU) ×3 (I/O) 10
  11. 11. HOT (3) • 8.3 HOT UPDATE → ID 1 001 A 10 002 B 8 UPDATE Heap 002 B 7 Only 003 C 20 Tuple 004 D 12 HOT ×1 (CPU) 1/2 ×1 (I/O) 1/3 11
  12. 12. HOT (4) • 8.3 HOT UPDATE HOT ID VACUUM 001 A 10 002 B 6 UPDATE 002 B 7 003 C 20 004 D 12 HOT ×1 (CPU) ×1 VACUUM (I/O) 12
  13. 13. HOT • UPDATE – DELETE+INSERT • – – • – FillFactor – VACUUM VACUUM 13
  14. 14. PostgreSQL 8.3 1. – HOT OLTP 2. – 3. – WAL 4. VACUUM – VACUUM autovacuum 14
  15. 15. (2) 8.3 • (LDC) EnterpriseDB Performance Testing 15 http://community.enterprisedb.com/ldc/
  16. 16. • – (write) – (fsync) 8.2 8.3 PostgreSQL I/O I/O 16
  17. 17. PostgreSQL 8.3 1. – HOT OLTP 2. – 3. – WAL 4. VACUUM – VACUUM autovacuum 17
  18. 18. (3) 8.3 • – WAL I/O 1/2 BEGIN; TRUNCATE t; 35% COPY t FROM …; 0 20 40 60 80 COMMIT; pgbench -i -s30 ( COPY ) NTT OSS Center • ( ) – • InfoFrame DB Maintenance (NEC) • pg_bulkload ( , pgFoundry) 8.3 18
  19. 19. (4) 8.3 VACUUM • autovacuum VACUUM – (autovacuum_max_workers) 1 8.2 → VACUUM 8.3 A B VACUUM 19
  20. 20. autovacuum 8.1 fillfactor GIN 8.2 HOT XML autovacuum 8.3 20
  21. 21. PostgreSQL 8.3 – • HOT OLTP – • VACUUM, Background Writer ( ) – • SQL/XML, , , etc. 21

×