0

I see https://www.postgresql.org/docs/current/sql-reindex.html has

$ export PGOPTIONS="-P"
$ psql broken_db
...
broken_db=> REINDEX DATABASE broken_db;
broken_db=> \q

I see the below content, but I still did not understand.

Alternatively, a regular server session can be started with -P included in its command line options. The method for doing this varies across clients, but in all libpq-based clients, it is possible to set the PGOPTIONS environment variable to -P before starting the client. Note that while this method does not require locking out other clients, it might still be wise to prevent other users from connecting to the damaged database until repairs have been completed.

What is the meaning/benefit of this command: export PGOPTIONS="-P"

4
  • Did you see this though: "To recover safely, the server must be started with the -P option, which prevents it from using indexes for system catalog lookups".
    – mustaccio
    Jul 22, 2022 at 14:25
  • I don't understand reference document, also your explain.
    – Vy Do
    Jul 22, 2022 at 14:56
  • Did you see this part? "In this case it's important for the system to not have used any of the suspect indexes itself." I don't understand how that could be clearer.
    – jjanes
    Jul 22, 2022 at 18:46
  • I still don't understand.
    – Vy Do
    Jul 22, 2022 at 23:23

1 Answer 1

0

The -P option tells the server to start without using indexes for system catalog lookups:

To recover safely, the server must be started with the -P option, which prevents it from using indexes for system catalog lookups.

This is needed if you are attempting to recover from a corrupted index on a system table. If you are not attempting to recover from corruption, you won't need this option, and in fact should not use it since it will reduce server performance under normal circumstances.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.