Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
使いこなそうGUC
Search
ISHIDA Akio
August 26, 2009
Programming
9
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
使いこなそうGUC
ISHIDA Akio
August 26, 2009
More Decks by ISHIDA Akio
See All by ISHIDA Akio
SQLを実行したときに、PostgreSQLはどのようにデータにアクセスしているのか
iakio
0
300
Prophecyを使った ユニットテスト
iakio
0
15
phpspecで学ぶLondon School TDD
iakio
0
9
PostgreSQLの範囲型と排他制約
iakio
0
27
XIDを周回させてみよう
iakio
0
23
Other Decks in Programming
See All in Programming
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
220
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
500
S3 TablesのIcebergデータに、AIエージェントからアクセスしてみた / 20261016developersio2026joetsu-accessing-iceberg-in-s3tables-via-agent
kasacchiful
PRO
0
150
JIS keyboard support in Omarchy
lef237
0
110
Verilogで学ぶCPU自作入門
uyuki234
8
4.1k
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
28
32k
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
5
5.2k
phperだってパンチカードでコーディングしたい
o0h
PRO
0
330
残高管理から台帳サービスへの進化
artoy
1
200
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.6k
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
140
Featured
See All Featured
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
630
Building Adaptive Systems
keathley
44
3.2k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
710
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
320
Game over? The fight for quality and originality in the time of robots
wayneb77
1
300
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
410
Transcript
使いこなそうGUC
GUC • Grand Unified Configuration(ソースの中にしか出てこない 言葉かもしれない) • PostgreSQLの設定はどうやって変更する? • postgresql.confを書き換えたり
• SETコマンドとか • いつ反映される? • 再起動? • リロード? • 参考: • src/include/misc/guc.h
とりあえずSELECT * FROM pg_settings; • 8.3.7での実行例 • 以降、context列とsource列の説明です => SELECT
* FROM pg_settings; -[ RECORD 1 ]------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ---------------- name | add_missing_from setting | off unit | <Null> category | Version and Platform Compatibility / Previous PostgreSQL Versions short_desc | Automatically adds missing table references to FROM clauses. extra_desc | <Null> context | user vartype | bool source | default min_val | <Null> max_val | <Null> ...
context(1) • いつ変更が反映されるのか • internal • 内部的な設定値。変更不可(server_version等) • postmaster •
postmaster起動時 • postgresql.conf又はコマンドラインオプション • sighup • kill -HUP(pg_ctl reload等)で読み込む
context(2) • backend • バックエンド起動時(=接続時)のパラメータ • なので接続毎に異なる値を持つ • クライアントの環境変数や接続文字列 •
superuser • スーパーユーザがsetコマンドで変更可能 • user • どのユーザでもsetコマンドで変更可能
source(1) • 現在の値はどこで設定されたものか • default • environment variable • postmasterの環境変数
• PGDATESTYLE,PGPORT,PGCLIENTENCODING • 普通使いません • configuration file • postgresql.conf
source(2) • command line • postmasterのコマンドライン引数 • postgres -D data
--add_missing_from=on • pg_ctl start -D data -o “--add_missing_from=on” • database • ALTER DATABASE dbname SET foo to bar; • user • ALTER USER username SET foo to bar;
source(3) • client • 環境変数PGOPTIONS,PGCLIENTENCODINGや接続文字列 等 • PGOPTIONS=”-c add_missing_from=on” psql
• pg_connect(“options='--add_missing_from=on'”) • session • SETコマンド
8.4のpg_settings • vartypeにenumが追加された • sourcefile, sourcelineが追加された =# SELECT * from
pg_settings where name = 'log_statement'; -[ RECORD 1 ]----------------------------------- name | log_statement setting | none unit | <Null> category | Reporting and Logging / What to Log short_desc | Sets the type of statements logged. extra_desc | <Null> context | superuser vartype | enum source | default min_val | <Null> max_val | <Null> enumvals | {none,ddl,mod,all} boot_val | none reset_val | none sourcefile | /usr/home/ishida/pgsql/8.4.0/data/postgresql.conf sourceline | 500
case study(1) • 動作中のアプリのSQLのログを取りたい • contextはsuperuser • でもSETコマンドではそのセッションしか変更できない • postgresql.confを変更するのは面倒
• ALTER DATABASE又はALTER USERを使ってみれば?
間違ったGUCの使い方 • http://www.postgres.cz/index.php/PostgreSQL_SQL_Tricks #Any_other_session_variables