Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b8wc5-00037n-FN for pgsql-performance@arkaria.postgresql.org; Fri, 03 Jun 2016 21:26:41 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1b8wc5-000559-1x for pgsql-performance@arkaria.postgresql.org; Fri, 03 Jun 2016 21:26:41 +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 1b8wc4-00054q-GS for pgsql-performance@postgresql.org; Fri, 03 Jun 2016 21:26:40 +0000 Received: from mail-oi0-x231.google.com ([2607:f8b0:4003:c06::231]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1b8wc0-0004SX-Ht for pgsql-performance@postgresql.org; Fri, 03 Jun 2016 21:26:40 +0000 Received: by mail-oi0-x231.google.com with SMTP id j1so146300169oih.3 for ; Fri, 03 Jun 2016 14:26:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=E/HBqZ50bV2fuOujsNrF/1wg4bAPKaWaBOH7N61+hTU=; b=DwcjK16mXeMvp0B7HSPr+ckwEreCg5LwaT6zNjNqOd93sQakbw9WolueE0/0Hvv9UK IgfTUi+voIXT+y5QcrwjRFU0fDh9DxnRhE6HJ19q9/5e1kTDaKNwn0DmxEltmAyvk5zH fTANzGBL1wDHOq7mntPjqs7zKxkRctPMhccn0OW5xptnaeLbDa4De2CZ0O5Te8jkowDF QzjuWfObiNu+zgwqxeLcfJ3cplln+hihLqkfoqvemt+dZREAquVkVJQvl1Y3Vk1Rjlyd ttF7gaXhxuiJi5Eoop5f7CBVkTyO0AU4EsIrOCnGgWTs5hBNvZ0GnJaIzpnQjmnvxqJl 0F6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=E/HBqZ50bV2fuOujsNrF/1wg4bAPKaWaBOH7N61+hTU=; b=B+NuVf64E+PZXelcm9//Ce1QRI62TyBx+6GhDrgpv8AXmcoZ2B3bgxVWDRYrk5ceLJ wL0uGpufExpEeztIKUipPmBlzBA2JMc2OxU2rXkbK9q0Zf3vQhNoEmYo0QBjbo8Vg136 /WU6W5SHVAKfaZ5449b3toThmYOTbbwPEp/NJOoifBnEVxl9tO0n/WY/s3NmRtffTWEY ceht17xWoydW2BTasHekENBk3kRMMNNnsjTJRmSyXaj5sKW8+I8F6r1PIa7tEimfyIUT F+5j6tmxP+nmizXaqkMT1bGZAzMa73GdODPfvbzUSDJMg5Geu9mPelIX+DQSX38th+4j qNmA== X-Gm-Message-State: ALyK8tJqhUJHPCx5Gc+ZbFp0n5DrmHv4KGx+vntsUCIU7U+Ly26GzrP5vBgp59opRysSmmoMY8a63FkVjd02ag== X-Received: by 10.157.36.98 with SMTP id p89mr3346777ota.119.1464989194748; Fri, 03 Jun 2016 14:26:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.202.204.2 with HTTP; Fri, 3 Jun 2016 14:26:33 -0700 (PDT) In-Reply-To: <20160525140034.GB21220@telsasoft.com> References: <20160524173914.GA11880@telsasoft.com> <20160525140034.GB21220@telsasoft.com> From: Claudio Freire Date: Fri, 3 Jun 2016 18:26:33 -0300 Message-ID: Subject: Re: index fragmentation on insert-only table with non-unique column To: Justin Pryzby Cc: postgres performance list Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.7 (--) 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 Wed, May 25, 2016 at 11:00 AM, Justin Pryzby wrote: >> > First, I found I was able to get 30-50min query results on full week's table by >> > prefering a seq scan to an index scan. The row estimates seemed fine, and the >> > only condition is the timestamp, so the planner's use of index scan is as >> > expected. >> >> Can you show us the query? I would expect a bitmap scan of the index >> (which would do what you want, but even more so), instead. > See explain, also showing additional tables/views being joined. It's NOT doing > a bitmap scan though, and I'd be interested to find why; I'm sure that would've > improved this query enough so it never would've been an issue. > https://explain.depesz.com/s/s8KP > > -> Index Scan using cdrs_huawei_pgwrecord_2016_05_01_recordopeningtime_idx on cdrs_huawei_pgwrecord_2016_05_01 (cost=0.56..1601734.57 rows=8943848 width=349) > Index Cond: ((recordopeningtime >= '2016-05-07 00:00:00'::timestamp without time zone) AND (recordopeningtime < '2016-05-08 00:00:00'::timestamp without time zone)) Please show your guc settings ( see https://wiki.postgresql.org/wiki/Server_Configuration ) A plan node like that, if it would result in I/O, with proper configuration should have selected a bitmap index/heap scan. If it didn't, it probably thinks it has more cache than it really does, and that would mean the wrong setting was set in effective_cache_size. -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance