9.3 版本之前,当创建表时,如果有隐式的索引或序列,那么会抛出 NOTICE 信息,新版本后这些 NOTICE 信息不再抛出,个人觉得这些信息在建表时不出现为好,日志看上去简捷点。
文档中说明
Suppress messages about implicit index and sequence creation (Robert Haas) These messages now appear at DEBUG1 verbosity, so that they will not be shown by default.
备注:接着演示下。
9.2 版本创建表测试
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
[pg92@redhatB ~]$ psql francs francs psql (9.2. 1 ) Type "help" for help. francs=> show client_min_messages; client_min_messages --------------------- notice (1 row) francs=> create table test_notice (id serial primary key ,name varchar(32 )); NOTICE: CREATE TABLE will create implicit sequence "test_notice_id_seq" for serial column "test_notice.id" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "test_notice_pkey" for table "test_notice" CREATE TABLE francs=> /d test_notice Table "francs.test_notice" Column | Type | Modifiers --------+-----------------------+---------------------------------------------------------- id | integer | not null default nextval('test_notice_id_seq' ::regclass) name | character varying(32 ) |Indexes: "test_notice_pkey" PRIMARY KEY, btree (id), tablespace "tbs_francs_idx" Tablespace: "tbs_francs_idx"
备注:9.2 版本建表时抛出了隐式索引和序列信息。
9.3 版本创建表测试
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
[pg93@redhatB ~]$ psql francs francs psql (9.3beta1) Type "help" for help. francs=> show client_min_ messages; client_min_ messages --------------------- notice (1 row) francs=> create table test_notice (id serial primary key ,name varchar(32)); CREATE TABLE francs=> /d test_ notice Table "francs.test_notice" Column | Type | Modifiers --------+-----------------------+ ---------------------------------------------------------- id | integer | not null default nextval('test_notice_id_seq' ::regclass) name | character varying(32) | Indexes: "test_notice_pkey" PRIMARY KEY, btree (id)
备注:9.3 版本建表时不再抛出隐式索引和序列信息,这类信息出现在 debug1 日志模式,因此也有方法查看这些信息。
设置 client_min_messages=’debug1’
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
[pg93@redhatB ~]$ psql francs francs psql (9.3beta1) Type "help" for help. francs => show client_min_messages;client_min_messages --------------------- notice (1 row) francs => set client_min_messages ='debug1' ;SET francs => show client_min_messages;client_min_messages --------------------- debug1 (1 row) francs => create table test_notice2 (id serial primary key ,name varchar(32));DEBUG: CREATE TABLE will create implicit sequence "test_notice2_id_seq" for serial column "test_notice2.id" DEBUG: CREATE TABLE / PRIMARY KEY will create implicit index "test_notice2_pkey" for table "test_notice2" DEBUG: building index "test_notice2_pkey" on table "test_notice2" CREATE TABLE
备注:设置 client_min_messages=’debug1’ 后,这类信息可以查看到了。
原创文章,作者:1402239773,如若转载,请注明出处:https://blog.ytso.com/tech/database/237969.html