"Mark Woodward" <pgsql@mohawksoft.com> writes:
> PostgreSQL promptly uses all available memory for the query and
> subsequently crashes.
I'll bet a nickel this is on a Linux machine with OOM kill enabled.
What does the postmaster log show --- or look in the kernel log to
see if it mentions anything about an out-of-memory kill.
> freedb=# create table ucode as select distinct ucode from cdtitles group
> by ucode having count(ucode)>1 ;
> server closed the connection unexpectedly
What does EXPLAIN show as the plan for that? If it's a hash aggregate,
try with "enable_hashagg" turned off. How many distinct ucode values
are there in the table?
regards, tom lane