Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TLJvf-0002SC-2W for pgsql-performance@postgresql.org; Mon, 08 Oct 2012 20:27:55 +0000 Received: from mail-pa0-f46.google.com ([209.85.220.46]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TLJvd-0004JR-Bf for pgsql-performance@postgresql.org; Mon, 08 Oct 2012 20:27:54 +0000 Received: by mail-pa0-f46.google.com with SMTP id hz1so4287783pad.19 for ; Mon, 08 Oct 2012 13:27:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=YmaLNtsss+AmQXzq971aWB/2f8Wi5BPIHrNV4wky9mE=; b=cxkTtf7LDaF/db+RCI0W0xIiIWUzjaWOq09VTVHim9ozEu9jKWvqDDGANwFBwxuzvC rddHf4pJzzSKvAdoOmQNRT5jEuBWegKWpyvYhK8APtqMF5xgzbSpGzoA1SqDESDn4C/U Qk4u2XUy5PcKeN+O1JNzpg3uUgPnE2XpqAPEgbWNPHCjuqblmLf18EytyS4MCDvPq3Cf l3gR8H0bNtBR5Ym3ZyJcx2g+gpMQEULBgzx0iz3KkyI7J616thsreEgYGjqBslWPApbe zn7lX/cWJMUSxj8Z8aVCmGVfFvlMzgW4OXOUY+oa8dwFbiFC6T9QXzkrw2I0C8dW/pjO f7IA== Received: by 10.68.216.2 with SMTP id om2mr55846499pbc.88.1349728071020; Mon, 08 Oct 2012 13:27:51 -0700 (PDT) Received: from ayaki.localdomain (125-238-84-125.jetstream.xtra.co.nz. [125.238.84.125]) by mx.google.com with ESMTPS id y2sm11332564pax.29.2012.10.08.13.27.48 (version=SSLv3 cipher=OTHER); Mon, 08 Oct 2012 13:27:49 -0700 (PDT) Message-ID: <50733741.30609@ringerc.id.au> Date: Tue, 09 Oct 2012 04:27:45 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0 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-Gm-Message-State: ALoCoQkE1FI5nLTTOCSQdBC4XH2R0a7hFcp/gCTzHofXyebyMnnpBrwZhlmUZVeLqlx1nTATB2dq X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201210/56 X-Sequence-Number: 48015 On 10/08/2012 11:26 PM, Navaneethan R wrote: > Hi all, > > I have 10 million records in my postgres table.I am running the database in amazon ec2 medium instance. EC2 usually means "My I/O performance is terrible" and "medium instance" means "I don't have enough RAM for caching to make up for my terrible I/O" at the database sizes you're talking. Anything that hits most of the database is likely to perform pretty poorly on something like EC2. It might be worth considering one of the high memory or high I/O instances, but unfortunately they only come in "really big and really expensive". If you already have appropriate indexes and have used `explain analyze` to verify that the query isn't doing anything slow and expensive, it's possible the easiest way to improve performance is to set up async replication or log shipping to a local hot standby on real physical hardware, then do the query there. -- Craig Ringer