Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YWtg1-0004Aj-Dl for pgsql-performance@arkaria.postgresql.org; Sat, 14 Mar 2015 21:32:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YWtg0-0000E6-62 for pgsql-performance@arkaria.postgresql.org; Sat, 14 Mar 2015 21:32:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YWtfz-0000Dz-0M for pgsql-performance@postgresql.org; Sat, 14 Mar 2015 21:32:55 +0000 Received: from mbx.knossos.net.nz ([202.160.48.10]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YWtfo-0005rt-Ns for pgsql-performance@postgresql.org; Sat, 14 Mar 2015 21:32:50 +0000 Received: from [10.1.1.3] (121-99-179-57.bng1.nct.orcon.net.nz [121.99.179.57]) (authenticated bits=0) by mbx.knossos.net.nz (8.14.4/8.14.4) with ESMTP id t2ELWNGL015972 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Sun, 15 Mar 2015 10:32:23 +1300 Message-ID: <5504A8E7.7080008@archidevsys.co.nz> Date: Sun, 15 Mar 2015 10:32:23 +1300 From: Gavin Flower Organization: ArchiDevSys User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Varadharajan Mukundan CC: Tomas Vondra , vjoshi@zetainteractive.com, Scott Marlowe , "pgsql-performance@postgresql.org" Subject: Re: Performance issues References: <84a6fe4be04c3ef0a714851977860ac8@mail.gmail.com> <160b8780d89add7f23c4eb9c3debb99d@mail.gmail.com> <55034A48.4040409@2ndquadrant.com> <849e75d9463938372dd4c516f5c5d89c@mail.gmail.com> <55037CEA.5050906@2ndquadrant.com> <5504A2CE.30007@archidevsys.co.nz> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 15/03/15 10:23, Varadharajan Mukundan wrote: > Hi Gavin, > > Vivekanand is his first mail itself mentioned the below configuration > of postgresql.conf. It looks good enough to me. > > Total Memory : 8 GB > > shared_buffers = 2GB > > work_mem = 64MB > > maintenance_work_mem = 700MB > > effective_cache_size = 4GB Sorry, it didn't register when I read it! (Probably reading too fast) > > On Sat, Mar 14, 2015 at 10:06 PM, Gavin Flower > wrote: >> On 14/03/15 13:12, Tomas Vondra wrote: >>> On 14.3.2015 00:28, Vivekanand Joshi wrote: >>>> Hi Guys, >>>> >>>> So here is the full information attached as well as in the link >>>> provided below: >>>> >>>> http://pgsql.privatepaste.com/41207bea45 >>>> >>>> I can provide new information as well. >>> Thanks. >>> >>> We still don't have EXPLAIN ANALYZE - how long was the query running (I >>> assume it got killed at some point)? It's really difficult to give you >>> any advices because we don't know where the problem is. >>> >>> If EXPLAIN ANALYZE really takes too long (say, it does not complete >>> after an hour / over night), you'll have to break the query into parts >>> and first tweak those independently. >>> >>> For example in the first message you mentioned that select from the >>> S_V_D_CAMPAIGN_HIERARCHY view takes ~9 minutes, so start with that. Give >>> us EXPLAIN ANALYZE for that query. >>> >>> Few more comments: >>> >>> (1) You're using CTEs - be aware that CTEs are not just aliases, but >>> impact planning / optimization, and in some cases may prevent >>> proper optimization. Try replacing them with plain views. >>> >>> (2) Varadharajan Mukundan already recommended you to create index on >>> s_f_promotion_history.send_dt. Have you tried that? You may also >>> try creating an index on all the columns needed by the query, so >>> that "Index Only Scan" is possible. >>> >>> (3) There are probably additional indexes that might be useful here. >>> What I'd try is adding indexes on all columns that are either a >>> foreign key or used in a WHERE condition. This might be an >>> overkill in some cases, but let's see. >>> >>> (4) I suspect many of the relations referenced in the views are not >>> actually needed in the query, i.e. the join is performed but >>> then it's just discarded because those columns are not used. >>> Try to simplify the views as much has possible - remove all the >>> tables that are not really necessary to run the query. If two >>> queries need different tables, maybe defining two views is >>> a better approach. >>> >>> (5) The vmstat / iostat data are pretty useless - what you provided are >>> averages since the machine was started, but we need a few samples >>> collected when the query is running. I.e. start the query, and then >>> give us a few samples from these commands: >>> >>> iostat -x -k 1 >>> vmstat 1 >>> >>>> Would like to see if queries of these type can actually run in >>>> postgres server? >>> Why not? We're running DWH applications on tens/hundreds of GBs. >>> >>>> If yes, what would be the minimum requirements for hardware? We would >>>> like to migrate our whole solution on PostgreSQL as we can spend on >>>> hardware as much as we can but working on a proprietary appliance is >>>> becoming very difficult for us. >>> That's difficult to say, because we really don't know where the problem >>> is and how much the queries can be optimized. >>> >>> >> I notice that no one appears to have suggested the default setting in >> postgresql.conf - these need changing as they are initially set up for small >> machines, and to let PostgreSQL take anywhere near full advantage of a box >> have large amounts of RAM, you need to change some of the configuration >> settings! >> >> For example 'temp_buffers' (default 8MB) and 'maintenance_work_mem' (default >> 16MB) should be drastically increased, and there are other settings that >> need changing. The precise values depend on many factors, but the initial >> values set by default are definitely far too small for your usage. >> >> Am assuming that you are looking at PostgreSQL 9.4. >> >> >> >> Cheers, >> Gavin >> >> > > > -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance