From: Richard Huxton <dev@archonet.com>
To: soni de <soni.de@gmail.com>
Cc: Joshua D. Drake <jd@commandprompt.com>
Cc: Rajesh Kumar Mallah <mallah.rajesh@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Takes too long to fetch the data from database
Date: Tue, 11 Apr 2006 11:17:01 +0100
Message-ID: <443B821D.2000005@archonet.com> (raw)
In-Reply-To: <9f2e40a90604110005o101fe98enec2f8ac8f757c770@mail.gmail.com>
References: <9f2e40a90604100021n1cb694d0lb95f318f800f33ee@mail.gmail.com>
<a97c77030604100858h4ef89e92sa6ecdd0aca735edb@mail.gmail.com>
<443AA1D4.9010308@commandprompt.com>
<9f2e40a90604110005o101fe98enec2f8ac8f757c770@mail.gmail.com>
soni de wrote:
> I have flushed the database, so currently records in the "lan" table are:
> 665280
>
> but records can be increased more than 1GB and in that case it takes more
> than 1 hour
>
> Below is explain analyze output taken from the table having 665280 records
>
> pdb=# explain analyze SELECT sdate, stime, rbts from lan WHERE (
> ( bname = 'pluto' ) AND ( cno = 17 ) AND ( pno = 1 ) AND ( ( sdate
> >= '2004-07-21' ) AND ( sdate <= '2004-07-21' ) ) ) ORDER BY sdate, stime
> ;
>
> NOTICE: QUERY PLAN:
> Sort (cost=17.13..17.13 rows=1 width=16) (actual time=619140.18..619140.29rows
> =288 loops=1)
> -> Index Scan using lan_pkey on lan (cost=0.00..17.12 rows=1 width=16)
> (actual time=7564.44..619121.61 rows=288 loops=1)
>
> Total runtime: 619140.76 msec
OK - there is clearly something wrong here when you take 10 minutes to
fetch 288 rows from an index.
1. VACUUM FULL VERBOSE lan;
2. test again, and if that doesn't work...
3. REINDEX TABLE lan;
4. test again
I'm guessing you have a *lot* of dead rows in there.
--
Richard Huxton
Archonet Ltd
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: dev@archonet.com, soni.de@gmail.com, jd@commandprompt.com, mallah.rajesh@gmail.com
Subject: Re: Takes too long to fetch the data from database
In-Reply-To: <443B821D.2000005@archonet.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