Re: [HACKERS] [PATCHES] pgstattuple extension for indexes
Bruce Momjian [EMAIL PROTECTED] writes: Patch applied. Thanks. For some reason I expected this patch to correct the portability errors and design problems identified here: http://archives.postgresql.org/pgsql-patches/2006-07/msg00100.php Not only has it not fixed anything, it's made things worse: gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -g -fpic -I. -I../../src/include -D_GNU_SOURCE -c -o pgstattuple.o pgstattuple.c pgstattuple.c: In function 'pgstat_btree': pgstattuple.c:335: warning: format '%llu' expects type 'long long unsigned int', but argument 2 has type 'uint64' pgstattuple.c:335: warning: format '%llu' expects type 'long long unsigned int', but argument 3 has type 'uint64' pgstattuple.c:335: warning: format '%llu' expects type 'long long unsigned int', but argument 4 has type 'uint64' gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -g -fpic -I. -I../../src/include -D_GNU_SOURCE -c -o pgstatindex.o pgstatindex.c pgstatindex.c: In function 'bt_page_items': pgstatindex.c:564: warning: format '%d' expects type 'int', but argument 4 has type 'long unsigned int' pgstatindex.c:564: warning: format '%d' expects type 'int', but argument 4 has type 'long unsigned int' ar crs libpgstattuple.a pgstattuple.o pgstatindex.o The only reason the buildfarm isn't crashing on this contrib module is that it lacks any regression test to crash on. regards, tom lane ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org
Re: [HACKERS] [PATCHES] pgstattuple extension for indexes
Tom Lane wrote: gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -g -fpic -I. -I../../src/include -D_GNU_SOURCE -c -o pgstatindex.o pgstatindex.c pgstatindex.c: In function 'bt_page_items': pgstatindex.c:564: warning: format '%d' expects type 'int', but argument 4 has type 'long unsigned int' pgstatindex.c:564: warning: format '%d' expects type 'int', but argument 4 has type 'long unsigned int' I guess my '%d' should be '%zd', right? -- NAGAYASU Satoshi [EMAIL PROTECTED] Phone: +81-3-3523-8122 *** pgstatindex.c 2006-09-03 02:05:29.0 +0900 --- pgstatindex.c.new 2006-09-04 08:22:42.0 +0900 *** *** 561,567 values[j] = palloc(32); snprintf(values[j++], 32, (%u,%u), blkno, itup-t_tid.ip_posid); values[j] = palloc(32); ! snprintf(values[j++], 32, %d, IndexTupleSize(itup)); values[j] = palloc(32); snprintf(values[j++], 32, %c, IndexTupleHasNulls(itup) ? 't' : 'f'); values[j] = palloc(32); --- 561,567 values[j] = palloc(32); snprintf(values[j++], 32, (%u,%u), blkno, itup-t_tid.ip_posid); values[j] = palloc(32); ! snprintf(values[j++], 32, %zd, IndexTupleSize(itup)); values[j] = palloc(32); snprintf(values[j++], 32, %c, IndexTupleHasNulls(itup) ? 't' : 'f'); values[j] = palloc(32); ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq
Re: [HACKERS] [PATCHES] pgstattuple extension for indexes
ITAGAKI Takahiro [EMAIL PROTECTED] writes: The two attached patches fix contrib/pgstattuple. Good, applied. I made some additional changes to get install/uninstall/ reinstall to work cleanly after the latest additions, and to get it to compile without warnings on a 64-bit Fedora machine. (It seems to actually work there, too.) I notice that the original pgstattuple() function comes in two flavors, one with OID input and one with text-relation-name input. Shouldn't all the others be likewise? regards, tom lane ---(end of broadcast)--- TIP 6: explain analyze is your friend
Re: [HACKERS] [PATCHES] pgstattuple extension for indexes
Satoshi Nagayasu [EMAIL PROTECTED] writes: Tom Lane wrote: pgstatindex.c: In function 'bt_page_items': pgstatindex.c:564: warning: format '%d' expects type 'int', but argument 4 has type 'long unsigned int' I guess my '%d' should be '%zd', right? No, that sounds even less portable :-( Given the expected range of IndexTupleSize(), it seems sufficient to cast its result to int and then use %d formatting. I've done that in the latest commit. regards, tom lane ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
Re: [HACKERS] [PATCHES] pgstattuple extension for indexes
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 [EMAIL PROTECTED] - 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 [EMAIL PROTECTED] EnterpriseDBhttp://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org
Re: [HACKERS] [PATCHES] pgstattuple extension for indexes
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 [EMAIL PROTECTED] - 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 [EMAIL PROTECTED] Phone: +81-3-3523-8122 ---(end of broadcast)--- TIP 6: explain analyze is your friend
Re: [HACKERS] [PATCHES] pgstattuple extension for indexes
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 [EMAIL PROTECTED] - 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 - pgstatindex.tar.gz Description: GNU Zip compressed data ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [HACKERS] [PATCHES] pgstattuple extension for indexes
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 [EMAIL PROTECTED] - 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 [EMAIL PROTECTED] EnterpriseDBhttp://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [HACKERS] [PATCHES] pgstattuple extension for indexes
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 Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ---(end of broadcast)--- TIP 6: explain analyze is your friend
Re: [HACKERS] [PATCHES] pgstattuple extension for indexes
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 [EMAIL PROTECTED] EnterpriseDBhttp://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + ---(end of broadcast)--- TIP 6: explain analyze is your friend
Re: [HACKERS] [PATCHES] pgstattuple extension for indexes
ITAGAKI Takahiro [EMAIL PROTECTED] 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 ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match