How do I REINDEX the built-in EventSentry database?

Article ID: 320
Category: Database
Applies to: v2.93.1 or later
Updated: 2023-05-09

If you are running the built-in PostgreSQL database you can perform maintenance using the pgAdmin administration and management tool, which is included with EventSentry.

Running the REINDEX maintenance command in PostgreSQL will rebuild all indexes using current data and replace the old copy of the index. There are several scenarios in which to use REINDEX:

  • An index has become corrupted and no longer contains valid data.
  • An index has become fragmented over an extended period of time.
  • An index has become "bloated" in size and contains many empty or nearly-empty pages that can be reclaimed as free disk space.

Option A

REINDEX the entire database using pgAdmin:

1a. Check the size of your indexes in the web reports. Log onto the web reports and then use the menu to choose Settings > Database Usage. The "indexes" size in the top right corner is the amount of free space you need for rebuilding the indexes.

2a. If you have enough free space, use the Windows Start Menu to search for PgAdmin or browse to EventSentry > PgAdmin4 (EventSentry > Database > PgAdmin if you're using an older version). You can also manually launch the exe from:

C:\Program Files\EventSentry\postgresql14\pgadmin\runtime\pgadmin4.exe

Or, if you're on an older version:

C:\Program Files (x86)\EventSentry\postgresql96\pgadmin\pgAdmin3.exe

3a. Double-click the "EventSentry Database" item on the left to connect, and log in with the postgres account

4a. On the left side, browse to Databases > EventSentry. Right-click the EventSentry database and select Maintenance

5a. Select REINDEX and click OK.

* Depending on the size of your indexes this action may take an hour or more.


Option B

REINDEX a specific table using pgAdmin:

In step 1a above, if you don't want to reindex the whole database, or you do but you don't have enough free space, you can look at your largest tables and see the index size of each table. If you do have enough free space to reindex a particular table, you can use these steps:

1b. Use the Windows Start Menu to search for PgAdmin or to browse EventSentry > PgAdmin4 (EventSentry > Database > PgAdmin if you're using an older version). You can also manually launch the exe from:

C:\Program Files\EventSentry\postgresql14\pgadmin\runtime\pgadmin4.exe

Or, if you're on an older version:

C:\Program Files (x86)\EventSentry\postgresql96\pgadmin\pgAdmin3.exe

2b. Double-click the "EventSentry Database" item on the left to connect, and log in with the postgres account

3b. On the left side browse to Databases > EventSentry > Schemas > eventsentry > Tables. Right-click the table that you want to reindex and choose Maintenance.

4b. Select "REINDEX" and click OK. This can take a long time to finish.


Option C

Not enough space to reindex the whole database or a specific table:

If you need to reindex but do not have enough free space for Option A or Option B, please contact our support department since it is often possible to run customized scripts that will reindex your database.