postgres, i want my create index to be non blocking to the executing session, however i…
- User
postgres, i want my create index to be non blocking to the executing session, however i dont want it to be CONCURRENTLY
Assistant
In PostgreSQL, you can achieve non-blocking index creation for your session without using CONCURRENTLY by launching the CREATE INDEX in a separate background session. Here's how:
sqlSELECT pg_advisory_lock(123456); -- Get a lock with a unique ID SELECT pg_terminate_backend(pg_backend_pid()); -- This will terminate current session but... -- The following command will keep running in the background SELECT pg_background_launch($$ SELECT pg_advisory_unlock(123456); -- Release the lock CREATE INDEX my_index_name ON my_table(column_name); $$);
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.