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
26
XIDを周回させてみよう
iakio
0
23
Other Decks in Programming
See All in Programming
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
220
速く作れる。その次は、速く確かめられる開発へ 〜AIネイティブ開発を支える、Shift Down〜 / Can build fast. Next, moving to development where we can verify fast.
rkaga
5
4.3k
[GoCon2026] When Goroutines Are Not Enough: Runtime Locality in High-Throughput Go
takehaya
6
2.4k
Java 27新機能 / Java 27 new features
kishida
2
170
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
190
巨大モノリシックアプリ モダン化大作戦
ktcryomm
1
1.1k
大喜利で理解するLLM as a Judge / Understanding LLM-as-a-Judge through Ogiri
rockname
0
160
TiDB Cloudのカスタムコントローラーによるオートスケール対応
takaidohigasi
0
130
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
1
12k
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
1
510
パズルゲームの作り方 / how to make puzzle games
kaityo256
PRO
2
160
Vue Fes Japan 2026 タイムテーブル徹底解説
448jp
1
500
Featured
See All Featured
Paper Plane (Part 1)
katiecoart
PRO
2
11k
Designing Powerful Visuals for Engaging Learning
tmiket
1
580
Speed Design
sergeychernyshev
33
2.1k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
700
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
410
The Pragmatic Product Professional
lauravandoore
37
7.5k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
290
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
Utilizing Notion as your number one productivity tool
mfonobong
4
590
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