Received: from candle.pha.pa.us (candle.navpoint.com [162.33.245.46]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5CIHtE98837 for ; Tue, 12 Jun 2001 14:17:55 -0400 (EDT) (envelope-from pgman@candle.pha.pa.us) Received: (from pgman@localhost) by candle.pha.pa.us (8.10.1/8.10.1) id f5CI98q28375; Tue, 12 Jun 2001 14:09:08 -0400 (EDT) From: Bruce Momjian Message-Id: <200106121809.f5CI98q28375@candle.pha.pa.us> Subject: Re: remote database queries In-Reply-To: <009101c0e98e$872bdb00$0205a8c0@jecw2k1> "from Joe Conway at May 30, 2001 09:59:52 pm" To: Joe Conway Date: Tue, 12 Jun 2001 14:09:08 -0400 (EDT) CC: pgsql-hackers@postgresql.org X-Mailer: ELM [version 2.4ME+ PL90 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Archive-Number: 200106/354 X-Sequence-Number: 9966 Your patch has been added to the PostgreSQL unapplied patches list at: http://candle.pha.pa.us/cgi-bin/pgpatches I will try to apply it within the next 48 hours. > > Until we fix that (maybe for 7.2, maybe not) your existing hack is > > probably pretty reasonable. You could save some cycles by avoiding > > conversion to text, though --- instead return an opaque datum that is > > pointer-to-tuple-slot and let the dblink_tok function extract fields > > from the tuple. Look at SQL function support and the FieldSelect > > expression node type for inspiration. > > > > I changed the dblink() function to return a pointer instead of concatenated > text, and dblink_tok() to use the pointer. FWIW, a query on a small (85 > tuples) remote (a second PC on a 100baseT subnet) table takes about 34 > milliseconds (based on show_query_stats) versus about 4 milliseconds when > run locally. It actually takes a bit longer (~65 milliseconds) when run > against a second database on the same PC. The original text parsing version > was about 25% slower. > > Although shifting from text parsing to pointer passing is more efficient, I > have one more question regarding this -- for now ;) -- is there any way to > check the pointer passed to dblink_tok() to be sure it came from dblink()? > > Thanks, > > -- Joe > [ Attachment, skipping... ] > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026