From: DeskNow Knowledge Base

Maintenance tasks for the database (Windows)

Normally the embedded database in DeskNow for Windows (PostgresSQL) does not need special maintenance.

However if you experience slow performance, it may be useful to 'vacuum' (a sort of disk defragmentation for databases) and 'reindex' (recalculate indexes so that the database can find data faster) the database.

The commands to perform these two tasks are, respectively:

"C:\Program Files\DeskNow\pgsql\bin\vacuumdb.exe" -a -U postgres -h 


"C:\Program Files\DeskNow\pgsql\bin\reindexdb.exe" -a -U postgres -h

When prompted for a password, type 'pgpassword'.

These tasks may take a while to run (even a few hours for large databases), so it is best to run them on weekends or at night to avoid slowing down normal operations.

How to schedule these tasks to run automatically

You can use the Windows Scheduled Tasks function to schedule these tasks to run automatically, ex. every Sunday at 1 AM. Make sure to not schedule the automated database backup in DeskNow for that day, or the two operations would run at the same time, and result in a very slow execution! Also do not schedule these tasks to run at the same time - it will just slow them down. As an example, you may run vauumdb on saturday night, reindex on sunday night, and backups every other day of the week.

To run the tasks automatically, first you must store the password in the system so that it is not requested at prompt. Simply create a text file with just this line of content:


and save it as C:\Documents and Settings\<your windows account name>\Application Data\postgresql\pgpass.conf

On Windows 7, this path would be found in Windows Explorer under the Desktop, as <your windows account name>\AppData\Roaming\postgresql .

Make sure to create the folder called 'postgresql' if it does not exist.

Then run one of the two commands above, and verify that you're not asked for a password.

You can then set the windows 'Scheduled tasks' (Start/All programs/Accessories/System tools/Scheduled taks) to run a command at a certain time. Use the 'browse' button to find the vacuumdb program on your disk, specify the frequency and time of the task, input the account and password that should be used to run the command (the account is the one where you created the file above). Check the 'advanced' button when you finish so that you can add the arguments to the command line. See screenshot below.