Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TLJeP-0002Uh-00 for pgsql-performance@postgresql.org; Mon, 08 Oct 2012 20:10:05 +0000 Received: from cerberus.pinpointresearch.com ([66.7.238.130] helo=polaris.pinpointresearch.com) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TLJeM-0008SC-6r for pgsql-performance@postgresql.org; Mon, 08 Oct 2012 20:10:04 +0000 Received: from [192.168.1.179] (betelgeuse.pinpointresearch.com [192.168.1.179]) by polaris.pinpointresearch.com (Postfix) with ESMTP id 9F000E00EC82; Mon, 8 Oct 2012 13:09:59 -0700 (PDT) Message-ID: <50733317.9080408@pinpointresearch.com> Date: Mon, 08 Oct 2012 13:09:59 -0700 From: Steve Crawford User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120912 Thunderbird/15.0.1 MIME-Version: 1.0 To: Navaneethan R CC: pgsql-performance@postgresql.org Subject: Re: Scaling 10 million records in PostgreSQL table References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -4.0 (----) X-Archive-Number: 201210/55 X-Sequence-Number: 48014 On 10/08/2012 08:26 AM, Navaneethan R wrote: > Hi all, > > I have 10 million records in my postgres table.I am running the database in amazon ec2 medium instance. I need to access the last week data from the table. > It takes huge time to process the simple query.So, i throws time out exception error. > > query is : > select count(*) from dealer_vehicle_details where modified_on between '2012-10-01' and '2012-10-08' and dealer_id=270001; > > After a lot of time it responds 1184 as count > > what are the ways i have to follow to increase the performance of this query? > > The insertion also going parallel since the daily realtime updation. > > what could be the reason exactly for this lacking performace? > > What version of PostgreSQL? You can use "select version();" and note that 9.2 has index-only scans which can result in a substantial performance boost for queries of this type. What is the structure of your table? You can use "\d+ dealer_vehicle_details" in psql. Have you tuned PostgreSQL in any way? If so, what? Cheers, Steve