The issue was resolved by changing the following parameters * `work_mem` changed from 4mb to 50 mb * `random_Page_size` changed to 1 from 4 * `max_wal_size` reduced to 128 mb from 2 gb * `cpu_index_tuple_cost` to 0.003 Also changed the following as suggested by @Gerad H.pille max_parallel__Workers_per_Gather max_parallel_maintainence_workers