Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id AA984475FFC for ; Sun, 9 Jun 2002 15:06:06 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 5A62C475D21 for ; Sun, 9 Jun 2002 15:00:59 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g59J0wb06696; Sun, 9 Jun 2002 15:00:58 -0400 (EDT) To: Gunther Schadow Cc: pgsql-sql Subject: Re: Support for distributed queries with semijoins could be possible, if ... In-reply-to: <3D0393D0.2070208@aurora.regenstrief.org> References: <3D0393D0.2070208@aurora.regenstrief.org> Comments: In-reply-to Gunther Schadow message dated "Sun, 09 Jun 2002 12:43:44 -0500" Date: Sun, 09 Jun 2002 15:00:58 -0400 Message-ID: <6693.1023649258@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200206/97 X-Sequence-Number: 8062 Gunther Schadow writes: > SELECT fever.patient_id AS patient_id, > fever.value AS fever, > wbc.value AS wbc > FROM (SELECT patient_id, value > FROM STDIN) fever > INNER JOIN Observation wbc > ON fever.patient_id = wbc.patient_id > WHERE wbc.type_code = 'WHITE BLOOD CELL COUNT' > AND wbc.value < 1000; A much more direct way of doing it is to leave the client out of the loop. The data from system A could be pulled directly into system B, using e.g. Joe Conway's contrib/dblink package. dblink is pretty awkward to use in 7.2 but in 7.3 it should be a lot nicer --- the returned data can be treated as a table function... regards, tom lane