>>>>> "Waruna" == Waruna Geekiyanage <waruna@xxxxxxxxxxx> writes: Waruna> I have a select query with 2 sub selects. When I run that Waruna> query CPU usage goes to 98% for postgres. Does sub Waruna> selects eat more resources and slower the queries? Is Waruna> there any alternatives to sub selects? You are going to have to give us a clue as to what those sub-selects are and what they are doing. If there is an "order by" clause anywhere, that could cause high CPU. If the query is not using indicies, that might cause a problem. Have you tried EXPLAIN? roland -- PGP Key ID: 66 BC 3B CD Roland B. Roberts, PhD RL Enterprises roland@xxxxxxxxxxx 76-15 113th Street, Apt 3B roland@xxxxxxxxxxxxx Forest Hills, NY 11375