pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
To: pgsql-performance@postgresql.org
Subject: Re: for help!
Date: Tue, 15 Apr 2003 15:24:11 +0530
Message-ID: <200304151524.11721.shridhar_daithankar@nospam.persistent.co.in> (raw)
In-Reply-To: <000901c30333$a52b7550$3c10a9c0@jinrong.sis.sh.cn>
References: <000901c30333$a52b7550$3c10a9c0@jinrong.sis.sh.cn>

On Tuesday 15 April 2003 15:14, you wrote:
> The postgreSQL database we used need to process several millions records.
> There are only six tables in the database. one of them contains several
> million records, the  Others are less smaller. We need select more than 100
> thousands records from the talbe which contains several million records in
> 10 seconds.  In the process of selecting, the speed of selecting is not
> stable. Sometimes it cost 2 minutes , but sometimes 20 seconds. After
> analyzing the time wasting in the process, we found the speed of  function
> Count(*) is very slow. At the same time we have finished the setup of some
> parameters like max_fsm_relation, max_fsm_pages, share memory size etc, but
> the performance is not improved satisfied.

Why do you need to do select count(*) to select more than 100 thousand 
records?

Postgresql being MVCC database, select count(*) is not going to be anywhere 
near good, especially if you have transactions occuring on table.

As far as just selecting rows from table, that should be tad fast if there are 
proper indexes, table in analyzed every now and then and there are enough 
shared buffers.

If you post your queries and table schemas, that would be much helpful. Your 
tweaked settings in postgresql.conf and hardware spec. would be good as well.

> Under this condition, I want get some useful suggestion from you. How to
> optimize the database?  How to improve the Count(*)? Because we  want to
> get the number of records in the recordset  we got.

If you are using say libpq, you don't need to issue a select count(*) where 
foo and select where foo, to obtain record count and the records themselves. 
I believe every other interface stemming from libpq should provide any such 
hooks as well. Never used any other myself (barring ecpg)

 HTH

 Shridhar




view thread (8+ messages)  latest in thread

Message-ID: <200304151524.11721.shridhar_daithankar@nospam.persistent.co.in>
Permalink:  ../200304151524.11721.shridhar_daithankar@nospam.persistent.co.in/
Also on:    postgresql.org/message-id/200304151524.11721.shridhar_daithankar@nospam.persistent.co.in

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: shridhar_daithankar@persistent.co.in
  Subject: Re: for help!
  In-Reply-To: <200304151524.11721.shridhar_daithankar@nospam.persistent.co.in>
  References: <000901c30333$a52b7550$3c10a9c0@jinrong.sis.sh.cn> <200304151524.11721.shridhar_daithankar@nospam.persistent.co.in>

* 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