X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 844694758E6 for ; Tue, 25 Feb 2003 05:11:43 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 61442-08 for ; Tue, 25 Feb 2003 05:11:32 -0500 (EST) Received: from beth.uniforum.org.za (beth.coza.net.za [206.223.136.193]) by postgresql.org (Postfix) with ESMTP id 546344758BD for ; Tue, 25 Feb 2003 01:49:14 -0500 (EST) Received: from beth.uniforum.org.za (mixo.coza.net.za [206.223.136.225]) by beth.uniforum.org.za (8.11.6/8.11.2) with ESMTP id h1P6nBF12469 for ; Tue, 25 Feb 2003 08:49:12 +0200 Message-ID: <3E5B1349.80705@beth.uniforum.org.za> Date: Tue, 25 Feb 2003 08:55:05 +0200 From: mixo User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020827 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql Subject: two dates Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new X-Archive-Number: 200303/27 X-Sequence-Number: 12067 I have a table which has serveral time stamps include when an entry was 'created'. Each entry is identified by a unique 'id'. How can I best find entries created between two dates without going through each day between the two dates? Currently, going through each day to get the results takes about 23 minutes for 7 days as I have two other criteria for search: roughly I am doing about 16*17*n queries, where n=days between two dates (for 7 days, 16*17*7 = which a number that is too big for my liking).