How can I disable parallel queries in PostgreSQL?
From the docs,


  max_parallel_workers_per_gather (integer) Sets the maximum number of workers that can be started by a single Gather or Gather Merge node. Parallel workers are taken from the pool of processes established by max_worker_processes, limited by max_parallel_workers. Note that the requested number of workers may not actually be available at run time. If this occurs, the plan will run with fewer workers than expected, which may be inefficient. The default value is 2. Setting this value to 0 disables parallel query execution.


So to disable the parallel query planning use,

SET max_parallel_workers_per_gather = 0;


You can see that here, same query,

                                                  QUERY PLAN                                                  
--------------------------------------------------------------------------------------------------------------
 Seq Scan on foo  (cost=0.00..207292.03 rows=1000 width=15) (actual time=0.082..4715.721 rows=666667 loops=1)
   Filter: (lower(x) ~~ '%999.com'::text)
   Rows Removed by Filter: 9333333
 Planning time: 0.083 ms
 Execution time: 4736.202 ms