Re: Postgres: 7.4 or 8.0?

Tom Copeland
2005-11-07T18:35:48Z

On Mon, 2005-11-07 at 12:26 -0500, Grant Johnson wrote:
> >Cool, this is the first I''ve heard of this command.  Seems to
run pretty
> >quickly, too; at least, on RubyForge''s 100+ tables and 3.5M+
records it
> >ran in about 3 seconds.
> >
> >
> >
> That sounds a little too quick.   You may have only reindexed your
> system tables, and not your data tables.  REINDEX DATABASE redoes the
> system tables, not the data tables.   If you do not use the
> contrib/reindexall, you need to specify which tables to reindex.  If it
> did run that fast, that is great.   It just would surprise me.
>
> http://www.postgresql.org/docs/8.0/interactive/sql-reindex.html

Yup, you were right - I was just getting the system tables.  Reindexing
everything took about 30 seconds:

===============require ''rubygems''
require ''postgres-pr/connection''

c = PostgresPR::Connection.new("name", "user")
tsql = "SELECT tablename FROM pg_tables WHERE
tableowner=''gforge''"
c.query(tsql).rows.sort.each {|r|
  idx_sql = "REINDEX table #{r[0].strip}"
  puts "Reindexing #{r[0].strip}"
  c.query(idx_sql)
}
c.close
===============
Thanks again for the info,

Yours,

Tom