Thread: Re: [PATCHES] pgstattuple extension for indexes
ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp> writes: > Do we add pgstatindex as a new contrib module, > or merge it into contrib/pgstattuple? I believe Alvaro was suggesting that you should add it as an additional SQL function within contrib/pgstattuple. That'd be my advice too --- I don't see a reason to break this out as a separate contrib module. regards, tom lane
Hi folks, As I said on -PATCHES, I've been working on an utility to get a b-tree index information. I'm happy to introduce my new functions to you. pgstattuple module provides a `pgstatindex()`, and other small functions, which allow you to get b-tree internal information. I believe this module will be helpful to know b-tree index deeply. So please try it, send comment to me, and have fun. Thanks, -- NAGAYASU Satoshi <nagayasus@nttdata.co.jp> ----------------------------------------------------- pgbench=# \x Expanded display is on. pgbench=# SELECT * FROM pgstatindex('accounts_pkey'); -[ RECORD 1 ]------+-------- version | 2 tree_level | 1 index_size | 3588096 root_block_no | 3 internal_pages | 0 leaf_pages | 437 empty_pages | 0 deleted_pages | 0 avg_leaf_density | 59.5 leaf_fragmentation | 49.89 -----------------------------------------------------
Attachment
I thought these new functions were going to be merged into /contrib/pgstattuple. --------------------------------------------------------------------------- satoshi nagayasu wrote: > Hi folks, > > As I said on -PATCHES, I've been working on an utility to get > a b-tree index information. I'm happy to introduce > my new functions to you. > > pgstattuple module provides a `pgstatindex()`, and other small > functions, which allow you to get b-tree internal information. > I believe this module will be helpful to know b-tree index deeply. > > So please try it, send comment to me, and have fun. > > Thanks, > -- > NAGAYASU Satoshi <nagayasus@nttdata.co.jp> > > ----------------------------------------------------- > pgbench=# \x > Expanded display is on. > pgbench=# SELECT * FROM pgstatindex('accounts_pkey'); > -[ RECORD 1 ]------+-------- > version | 2 > tree_level | 1 > index_size | 3588096 > root_block_no | 3 > internal_pages | 0 > leaf_pages | 437 > empty_pages | 0 > deleted_pages | 0 > avg_leaf_density | 59.5 > leaf_fragmentation | 49.89 > ----------------------------------------------------- > > [ application/x-gzip is not supported, skipping... ] > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org -- Bruce Momjian bruce@momjian.us EnterpriseDB http://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. +
Bruce Momjian wrote: > > I thought these new functions were going to be merged into > /contrib/pgstattuple. Well, that's exactly what this patch seems to do ... -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc.
Alvaro Herrera wrote: > Bruce Momjian wrote: > > > > I thought these new functions were going to be merged into > > /contrib/pgstattuple. > > Well, that's exactly what this patch seems to do ... Well, looking at the tarball it puts everything in pgstatindex, and the Makefile is: #------------------------------------------------------------------------- # # pgstatindex Makefile # # $PostgreSQL$ # #------------------------------------------------------------------------- SRCS = pgstatindex.c MODULE_big = pgstatindex OBJS = $(SRCS:.c=.o) DOCS = DATA_built = pgstatindex.sql ifdef USE_PGXS PGXS := $(shell pg_config --pgxs) include $(PGXS) else subdir = contrib/pgstatindex top_builddir = /home/snaga/pgsql/sources/postgresql-8.1.3 include $(top_builddir)/src/Makefile.global include $(top_srcdir)/contrib/contrib-global.mk endif -- Bruce Momjian bruce@momjian.us EnterpriseDB http://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. +
nagayasu-san, This looks good, but we would like the code added to /contrib/pgstattuple, rather than it being its own /contrib module. Can you make that adjustment? Thanks. --------------------------------------------------------------------------- satoshi nagayasu wrote: > Hi folks, > > As I said on -PATCHES, I've been working on an utility to get > a b-tree index information. I'm happy to introduce > my new functions to you. > > pgstattuple module provides a `pgstatindex()`, and other small > functions, which allow you to get b-tree internal information. > I believe this module will be helpful to know b-tree index deeply. > > So please try it, send comment to me, and have fun. > > Thanks, > -- > NAGAYASU Satoshi <nagayasus@nttdata.co.jp> > > ----------------------------------------------------- > pgbench=# \x > Expanded display is on. > pgbench=# SELECT * FROM pgstatindex('accounts_pkey'); > -[ RECORD 1 ]------+-------- > version | 2 > tree_level | 1 > index_size | 3588096 > root_block_no | 3 > internal_pages | 0 > leaf_pages | 437 > empty_pages | 0 > deleted_pages | 0 > avg_leaf_density | 59.5 > leaf_fragmentation | 49.89 > ----------------------------------------------------- > > [ application/x-gzip is not supported, skipping... ] > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org -- Bruce Momjian bruce@momjian.us EnterpriseDB http://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. +
Bruce, I'll fix it in this week. Please wait a few days. Thanks. Bruce Momjian wrote: > nagayasu-san, > > This looks good, but we would like the code added to > /contrib/pgstattuple, rather than it being its own /contrib module. Can > you make that adjustment? Thanks. > > --------------------------------------------------------------------------- > > satoshi nagayasu wrote: >> Hi folks, >> >> As I said on -PATCHES, I've been working on an utility to get >> a b-tree index information. I'm happy to introduce >> my new functions to you. >> >> pgstattuple module provides a `pgstatindex()`, and other small >> functions, which allow you to get b-tree internal information. >> I believe this module will be helpful to know b-tree index deeply. >> >> So please try it, send comment to me, and have fun. >> >> Thanks, >> -- >> NAGAYASU Satoshi <nagayasus@nttdata.co.jp> >> >> ----------------------------------------------------- >> pgbench=# \x >> Expanded display is on. >> pgbench=# SELECT * FROM pgstatindex('accounts_pkey'); >> -[ RECORD 1 ]------+-------- >> version | 2 >> tree_level | 1 >> index_size | 3588096 >> root_block_no | 3 >> internal_pages | 0 >> leaf_pages | 437 >> empty_pages | 0 >> deleted_pages | 0 >> avg_leaf_density | 59.5 >> leaf_fragmentation | 49.89 >> ----------------------------------------------------- >> >> > > [ application/x-gzip is not supported, skipping... ] > >> ---------------------------(end of broadcast)--------------------------- >> TIP 4: Have you searched our list archives? >> >> http://archives.postgresql.org > -- NAGAYASU Satoshi <nagayasus@nttdata.co.jp> Phone: +81-3-3523-8122