I'm not really sure where to start debugging this, but in the last year I routinely have to wait a few minutes before RStudio becomes responsive after executing code chunks. This is not while RStudio is running a chunk but after chunks complete. I have grown accustomed to running beepr::beep() in the console to signal when RStudio is going to become responsive again.
These delays only seem to happen when RStudio is connected to a database, but I'm not sure how to diagnose or even detect the source of delays as they seem to happen randomly. I am at least sure it's not do to memory issue as the delays happen regardless of how much data I have pulled into memory.