Submit query using dblink that hung the host

From: Alex Lai <mlai(at)sesda2(dot)com>
To: postgres general support <pgsql-general(at)postgresql(dot)org>
Subject: Submit query using dblink that hung the host
Date: 2012-06-14 16:15:31
Message-ID: 4FDA0E23.1090004@sesda2.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

My host was freeze up after submitted the following query that prevented
me to ssh to the host.
I was unable to psql and submit pg_cancel_backend. The tables have over
20 millions rows.
Does dblink uses too much resource from the host when join large tables.
Hope someone can give me suggestion.

CREATE OR REPLACE VIEW missing_archiveset_in_mds_ops
(filename, esdt, archiveset) AS
select * from dblink('host=ops_host port=4001 user=omiops dbname=omiops',
'select filename, esdt, archiveset from
filemeta_archiveset join filemeta_common using(fileid)
join file using(fileid)') as t1(filename text,esdt text,archiveset int)
where (filename, esdt, archiveset) not in (
select filename, esdt, archiveset
from dblink('host=ops_host port=4002 user=omiops dbname=metamine',
'select filename, esdt, archiveset from
file_archiveset join filemeta using(fileid)
join filename using(fileid)') as t2(filename text,esdt text,archiveset
int));

--
Best regards,

Alex Lai
OMI SIPS DBA ADNET Systems , Inc.
7515 Mission Drive,
Suite A100 Lanham, MD 20706
301-352-4657 (phone)
301-352-0437 (fax)
alai(at)sesda2(dot)com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Crawford 2012-06-14 16:17:42 Re: Is there a way to ask PostgreSQL for the name of the computer it's running on?
Previous Message Tom Lane 2012-06-14 14:25:17 Re: Problem installing extensions on Lion