X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B6C5852AA6 for ; Sat, 2 Apr 2005 07:25:28 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92855-01 for ; Sat, 2 Apr 2005 06:25:23 +0000 (GMT) Received: from priv-edtnes51.telusplanet.net (outbound04.telus.net [199.185.220.223]) by svr1.postgresql.org (Postfix) with ESMTP id 0D8AB5398B for ; Sat, 2 Apr 2005 07:25:19 +0100 (BST) Received: from localhost ([199.185.220.240]) by priv-edtnes51.telusplanet.net (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP id <20050402062519.CPDS27369.priv-edtnes51.telusplanet.net@localhost>; Fri, 1 Apr 2005 23:25:19 -0700 Received: from 64.180.225.200 ( [64.180.225.200]) as user a3a18850@192.168.200.1 by webmail.telus.net with HTTP; Fri, 1 Apr 2005 22:25:19 -0800 Message-ID: <1112423119.424e3acf49c9f@webmail.telus.net> Date: Fri, 1 Apr 2005 22:25:19 -0800 From: Mischa To: Mischa Cc: "H.J. Sanders" , pgsql-performance@postgresql.org Subject: Re: date - range References: <1112421584.424e34d0d2d63@webmail.telus.net> In-Reply-To: <1112421584.424e34d0d2d63@webmail.telus.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.1-cvs X-Originating-IP: 64.180.225.200 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.082 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_POST, FORGED_RCVD_HELO X-Spam-Level: * X-Archive-Number: 200504/28 X-Sequence-Number: 11425 Quoting Mischa : [deleted] > SELECT People.* FROM People > JOIN Widths > ON People.start = today - today % Widths.width > AND People.width = Widths.width Yikes! I hit the SEND button one ohnosecend too fast. (1) You still ALSO have to test: ... AND today between first_date and last_date (2) On some SQL engines, it makes a different to how the engine can re-order the nested loops, if you make the index (width,start) instead of (start,width). Haven't tried on PG8 yet. -- "Dreams come true, not free."