Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dXD63-0008Iu-8g for pgsql-performance@arkaria.postgresql.org; Mon, 17 Jul 2017 20:58:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dXD62-0007RC-Q5 for pgsql-performance@arkaria.postgresql.org; Mon, 17 Jul 2017 20:58:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dXD49-00045d-9E for pgsql-performance@postgresql.org; Mon, 17 Jul 2017 20:56:29 +0000 Received: from mail-io0-x242.google.com ([2607:f8b0:4001:c06::242]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dXD45-0001H7-Vt for pgsql-performance@postgresql.org; Mon, 17 Jul 2017 20:56:28 +0000 Received: by mail-io0-x242.google.com with SMTP id 84so558244iop.2 for ; Mon, 17 Jul 2017 13:56:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=QSWfvJWI8gT7eIOdp/I3odjXg/uulPA+OjAcgRQOVks=; b=Yt8/OLkfp8pQf/jIlZBONeDzdcX/osUOE0ZxKcNQ9iRRLFNaU3RipEfIpiGhjZ4u61 GfC5/iV4w25rtilKQGDo0+XCHpAGXRIGt+2Or+5S/0GcdT65JuR5iWMTvz91Goiyd0x7 yUI+nGXGHwkUIF/dI4H4TQ3ErsHIqX4YMIti+4j+Tur0pnfv2CdUtu7nEtMqyTenimqM B3XyzmkFsMwhDKuIV/mBiAc9Icg+lRTHBD5rnEMqZhqphqrbq937aA00jNkNLogjUFY9 JR9iUV+2h8yaBjVX45RsB4bLk4DvLcj5i1yfuEI/t0sWyFTFB8SZJy/2/yOcFQN75Tdr gQLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=QSWfvJWI8gT7eIOdp/I3odjXg/uulPA+OjAcgRQOVks=; b=iBiWa4mJvAfyKwPRs/bKp+5b3uC2klKtfNkiyXr6LHuF04p9bcVfJtQkYqHXDGEgp6 P+Hf60/OY9QWcB96sxNsKeZiUjxvbrVsc+frMDRdrsuPU4fxMTAevIjEwT0m46VqZSuC AAf0FOkMpGrz2QirfZVqaFrex70ZzFNEAmE8bsVKACb7p3iPrDqYZ8IyXNeKInGB58B3 ecdYIDgna7WR78m+V4iZU03k1z+HxRRucNJKucBDuDS1brv4/LiO34ExGsLkv5dFFzXl qX0PKuDAA1vLaESoo7rSZ2Xk5qOrOMCyHOBteEWoSQi/67h5VF1hio5iiSEtbjenO7GB BD3w== X-Gm-Message-State: AIVw113TS7QSEeIsdNcRlC+ZkxCLOJHs8us4x2AmWg4brtfPHvepiUSP FCPEDu5zLWm+ObqGcfNC08uBJxoaAA== X-Received: by 10.107.8.23 with SMTP id 23mr21956092ioi.159.1500324984399; Mon, 17 Jul 2017 13:56:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.40.136 with HTTP; Mon, 17 Jul 2017 13:56:23 -0700 (PDT) In-Reply-To: References: From: Claudio Freire Date: Mon, 17 Jul 2017 17:56:23 -0300 Message-ID: Subject: Re: Very poor read performance, query independent To: Charles Nadeau Cc: Igor Neyman , Jeff Janes , "pgsql-performance@postgresql.org" Content-Type: text/plain; charset="UTF-8" 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 Fri, Jul 14, 2017 at 12:34 PM, Charles Nadeau wrote: > Workers Planned: 12 > Workers Launched: 12 > Buffers: shared hit=728798037 read=82974833 > -> Hash Semi Join > (cost=30059688.07..47951761.31 rows=220376 width=20) (actual > time=1268845.181..2007864.725 rows=7057357 loops=13) > Hash Cond: (flows.dstaddr = > flows_1.dstaddr) > Buffers: shared hit=728795193 > read=82974833 > -> Nested Loop > (cost=0.03..17891246.86 rows=220376 width=20) (actual time=0.207..723790.283 > rows=37910370 loops=13) > Buffers: shared hit=590692229 > read=14991777 > -> Parallel Seq Scan on flows > (cost=0.00..16018049.14 rows=55094048 width=20) (actual > time=0.152..566179.117 rows=45371630 loops=13) > Buffers: shared > hit=860990 read=14991777 > -> Index Only Scan using > mynetworks_ipaddr_idx on mynetworks (cost=0.03..0.03 rows=1 width=8) > (actual time=0.002..0.002 rows=1 loops=589831190) > Index Cond: (ipaddr >>= > (flows.srcaddr)::ip4r) > Heap Fetches: 0 > Buffers: shared > hit=589831203 12 workers on a parallel sequential scan on a RAID-10 volume of rotating disks may not be a good idea. Have you measured average request size and average wait times with iostat? Run "iostat -x -m -d 60" while running the query and copy a few relevant lines (or attach the whole thing). I suspect 12 parallel sequential scans are degrading your array's performance to random I/O performance, and that explains the 10MB/s very well (a rotating disk will give you about 3-4MB/s at random I/O, and you've got 2 mirrors on that array). You could try setting the max_parallel_workers_per_gather to 2, which should be the optimum allocation for your I/O layout. You might also want to test switching to the deadline scheduler. While the controller may get more aggregate thoughput rearranging your I/O requests, high I/O latency will severly reduce postgres' ability to saturate the I/O system itself, and deadlines tends to minimize latency. I've had good results in the past using deadline, but take this suggestion with a grain of salt, YMMV. -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance