From: Jim Nasby <jnasby@enova.com>
To: Daniel Farina <daniel@heroku.com>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Horrific time for getting 1 record from an index?
Date: Mon, 11 Nov 2013 15:57:47 -0600
Message-ID: <528152DB.60907@enova.com> (raw)
In-Reply-To: <CAAZKuFaroDOtTj1MiZYmv9ZuHck_LQ-B2LjP_gDotqRPXtofMg@mail.gmail.com>
References: <52815099.4080409@enova.com>
<CAAZKuFaroDOtTj1MiZYmv9ZuHck_LQ-B2LjP_gDotqRPXtofMg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>
On 11/11/13 3:51 PM, Daniel Farina wrote:
> On Mon, Nov 11, 2013 at 1:48 PM, Jim Nasby <jnasby@enova.com> wrote:
>> Postgres 9.1.9.
>>
>> explain analyze select min(insert_time) from cnu_stats.page_hits_raw ;
>> I checked and there were no un-granted locks... but I have a hard time
>> believing it actually too 257 seconds to get 2 pages (one index, one heap)
>> back from our SAN.
>
> Try adding EXPLAIN (ANALYZE, BUFFERS). I am wondering if you are
> reading through a lot of pages addressing tuples not visible to the
> transaction.
explain (analyze,buffers) select min(insert_time) from cnu_stats.page_hits_raw ;
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Result (cost=0.12..0.13 rows=1 width=0) (actual time=119.347..119.347 rows=1 loops=1)
Buffers: shared hit=1 read=9476
InitPlan 1 (returns $0)
-> Limit (cost=0.00..0.12 rows=1 width=8) (actual time=119.335..119.336 rows=1 loops=1)
Buffers: shared hit=1 read=9476
-> Index Scan using page_hits_raw_pkey on page_hits_raw (cost=0.00..5445004.65 rows=47165480 width=8) (actual time=119.333..119.333 rows=1 loops=1)
Index Cond: (insert_time IS NOT NULL)
Buffers: shared hit=1 read=9476
Total runtime: 119.382 ms
(9 rows)
We do run a regular process to remove older rows... I thought we were vacuuming after that process but maybe not.
--
Jim Nasby, Lead Data Architect (512) 569-9461
--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: jnasby@enova.com, daniel@heroku.com
Subject: Re: Horrific time for getting 1 record from an index?
In-Reply-To: <528152DB.60907@enova.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox