Search code examples
postgresqlindexingdatagrip

Datagrip: Create postgres index without waiting for execution


Is there a way to submit a command in datagrip to a database without keeping the connection open / asynchronously? I'm attempting to create indexes concurrently, but I'd also like to close my laptop.

My datagrip workflow: Select column in a database, click 'modify column', and eventually run code such as:

create index concurrently batchdisbursements_updated_index
    on de_testing.batchdisbursements (updated);

However, these run as background tasks and cancel if I exit datagrip.


Solution

  • However, these run as background tasks and cancel if I exit datagrip.

    What if you close your laptop without exiting datagrip? Datagrip is probably actively sending a cancellation message to PostgreSQL when you exit it. If you just close the laptop, I doubt it will do that. In that case, PostgreSQL won't notice the client has gone away until it tries to send a message, at which point the index creation should already be done and committed.

    But this is a fragile plan. I would ssh to the server, run screen (or one of the fancier variants), run psql in that, and create the indexes from there.