After upgrading from Ubuntu 19.04 to 19.10 I noticed certain lags and hanging problems which were not present in the 19.04 days. I'm using Regolith as my desktop environment (installed via its ppa) and I'm sure that the above problem is happening after upgrading to 19.10 . I have already disabled file indexing.
in Ubuntu 19.10 this problem happens due to problem with swap management . Tinkering with dirty_background broke my nautilus file explorer . Along with freezing when copying large files , i have encountered several performance issues due to bad swap management in 19.10 . Since completely disabling swap is not recommended and we can control the degree of writing into swap partition by setting swappiness .
so , we are going to set swappiness =1 .
sudo sysctl vm.swappiness=1
sudo gedit /etc/sysctl.conf
vm.swappiness=10
This helped me to improve overall performance issues in Ubuntu 19.10 while disabling swap completely eliminated all performance issues that i had with 19.10 but still i won't recommend doing that in normal situations .