Thread: Index counters of statistics collector does not work on 7.4devel
Fields idx_scan and idx_tup_fetch are not changed by an index scan. =# create table class1 (id integer); CREATE TABLE =# -- Insert 0..9999 into class1 =# create index class1_id_indexon class1 (id); CREATE INDEX =# vacuum analyze; VACUUM =# \x Expanded display is on. =# select* from pg_stat_all_tables where relname = 'class1'; -[ RECORD 1 ]-+------- relid | 17166 schemaname | public relname | class1 seq_scan | 2 seq_tup_read | 13000 idx_scan | 0 idx_tup_fetch | 0 n_tup_ins | 10000 n_tup_upd | 0 n_tup_del | 0 =# \x Expanded display is off. =# explain select * from class1 where id = 1234; QUERY PLAN ------------------------------------------------------------------------------ Index Scanusing class1_id_index on class1 (cost=0.00..3.01 rows=2 width=4) Index Cond: (id = 1234) (2 rows) =# \x Expanded display is on. =# select * from pg_stat_all_tables where relname = 'class1'; -[ RECORD 1 ]-+------- relid | 17166 schemaname | public relname | class1 seq_scan | 2 seq_tup_read |13000 idx_scan | 0 idx_tup_fetch | 0 n_tup_ins | 10000 n_tup_upd | 0 n_tup_del | 0 =# Kenji Sugita
"Kenji Sugita" <sugita@srapc1327.sra.co.jp> wrote: > =# explain select * from class1 where id = 1234; > QUERY PLAN > ---------------------------------------------------------------------- -------- > Index Scan using class1_id_index on class1 (cost=0.00..3.01 rows=2 width=4) > Index Cond: (id = 1234) > (2 rows) I don't think that the select is really performed, try the same experiment but doing explain analyze instead. Regards Gaetano Mendola
From: "Mendola Gaetano" <mendola@bigfoot.com> Subject: Re: [HACKERS] Index counters of statistics collector does not work on 7.4devel Date: Sun, 20 Jul 2003 15:42:29 +0200 ;;; "Kenji Sugita" <sugita@srapc1327.sra.co.jp> wrote: ;;; > =# explain select * from class1 where id = 1234; ;;; > QUERY PLAN ;;; > ---------------------------------------------------------------------- ;;; -------- ;;; > Index Scan using class1_id_index on class1 (cost=0.00..3.01 rows=2 ;;; width=4) ;;; > Index Cond: (id = 1234) ;;; > (2 rows) ;;; ;;; I don't think that the select is really performed, try the same experiment ;;; but doing ;;; explain analyze instead. I forgot to include a select without explain. I found it July 15. Anyway it works for today's version. Kenji Sugita