Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 1898D475DB7 for ; Mon, 29 Jul 2002 16:40:07 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g6TKdiVk011829; Mon, 29 Jul 2002 16:39:44 -0400 (EDT) To: Gunther Schadow Cc: pgsql-sql@postgresql.org Subject: Re: Decision support query inefficiencies ... In-reply-to: <3D459ED0.3030000@aurora.regenstrief.org> References: <3D459ED0.3030000@aurora.regenstrief.org> Comments: In-reply-to Gunther Schadow message dated "Mon, 29 Jul 2002 15:00:16 -0500" Date: Mon, 29 Jul 2002 16:39:43 -0400 Message-ID: <11828.1027975183@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200207/441 X-Sequence-Number: 8819 Gunther Schadow writes: > A very frequent decision support query we have to make is to get the > last act of a certain type that occurred before a certain cut-off > date. This seems pretty close to the type of problem DISTINCT ON is intended to solve. Look at the "weather report" example in the SELECT reference page. regards, tom lane