I have a series of deletes and updates on a few tables in a Postgres database I manage. It has been suggested to schedule a reindex after the series of deletes as a solution to the 10 minute next-step update freezing infinitely (as it randomly does.) The DOS instructions provide this:
Usage:
reindexdb [OPTION]... [DBNAME]
Options:
-a, --all reindex all databases
-d, --dbname=DBNAME database to reindex
-e, --echo show the commands being sent to the server
-i, --index=INDEX recreate specific index only
-q, --quiet don't write any messages
-s, --system reindex system catalogs
-t, --table=TABLE reindex specific table only
--help show this help, then exit
--version output version information, then exit
Connection options:
-h, --host=HOSTNAME database server host or socket directory
-p, --port=PORT database server port
-U, --username=USERNAME user name to connect as
-w, --no-password never prompt for password
-W, --password force password prompt
We have to use version 9.1.3 as this is the corporate standard. I have tried every option I can think of but it won't take the command to reindex:
reindexdb.exe -U username=MyUserName -W MyPassword -t table=MyDatabase.MyTable
I've also tried
reindexdb.exe -U MyUserName -W MyPassword -t MyDatabase.MyTable
and
reindexdb.exe -U MyUserName -W MyPassword -t MyTable -d MyDatabase
...but they all end with the error:
reindexdb: too many command-line arguments (first is "-t")
Does anyone have a working sample that would be able to clarify what the right syntax is?
This did it:
reindexdb.exe -d MyDatabase -U postgres -t MyTable
As @Colonel Thirty Two and @Erwin Brandstetter noted, removing the password entirely is possible through %APPDATA%\postgresql\pgpass.conf