使いこなそうGUC

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    使いこなそうGUC - Presentation Transcript

    1. 使いこなそうGUC
    2. GUC ● Grand Unified Configuration(ソースの中にしか出てこない 言葉かもしれない) ● PostgreSQLの設定はどうやって変更する? ● postgresql.confを書き換えたり ● SETコマンドとか ● いつ反映される? ● 再起動? ● リロード? ● 参考: ● src/include/misc/guc.h
    3. とりあえず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> ...
    4. context(1) ● いつ変更が反映されるのか ● internal ● 内部的な設定値。変更不可(server_version等) ● postmaster ● postmaster起動時 ● postgresql.conf又はコマンドラインオプション ● sighup ● kill -HUP(pg_ctl reload等)で読み込む
    5. context(2) ● backend ● バックエンド起動時(=接続時)のパラメータ ● なので接続毎に異なる値を持つ ● クライアントの環境変数や接続文字列 ● superuser ● スーパーユーザがsetコマンドで変更可能 ● user ● どのユーザでもsetコマンドで変更可能
    6. source(1) ● 現在の値はどこで設定されたものか ● default ● environment variable ● postmasterの環境変数 ● PGDATESTYLE,PGPORT,PGCLIENTENCODING ● 普通使いません ● configuration file ● postgresql.conf
    7. 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;
    8. source(3) ● client ● 環境変数PGOPTIONS,PGCLIENTENCODINGや接続文字列 等 ● PGOPTIONS=”-c add_missing_from=on” psql ● pg_connect(“options='--add_missing_from=on'”) ● session ● SETコマンド
    9. 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
    10. case study(1) ● 動作中のアプリのSQLのログを取りたい ● contextはsuperuser ● でもSETコマンドではそのセッションしか変更できない ● postgresql.confを変更するのは面倒 ● ALTER DATABASE又はALTER USERを使ってみれば?
    11. 間違ったGUCの使い方 ● http://www.postgres.cz/index.php/PostgreSQL_SQL_Tricks #Any_other_session_variables
    SlideShare Zeitgeist 2009

    + iakioiakio Nominate

    custom

    182 views, 0 favs, 0 embeds more stats

    2009/8/26 日本PostgreSQLユーザ会北海道支 more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 182
      • 182 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 1
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Tags