> I tried
>
> select distinct job_num, (select count(*) from search_records j where
> j.job_num=k.job_num) from search_records k
can't you just do:
select job_num, count(job_num) from search_records group by job_num
order by job_num
http://www.postgresql.org/idocs/index.php?queries.html#QUERIES-GROUP
and creating an index on job_num might improve performace even more, but
I don't know if index scans are used in aggregate functions or not.
eric