Re: postgresql performance - Mailing list pgsql-performance

From Dave Dutcher
Subject Re: postgresql performance
Date
Msg-id 01b501c87eca$8da00ff0$8e00a8c0@tridecap.com
Whole thread Raw
In response to postgresql performance  (SPMLINGAM <spmlingam@gmail.com>)
Responses Re: postgresql performance
List pgsql-performance
> -----Original Message-----
> From: SPMLINGAM
> Subject: [PERFORM] postgresql performance
>
> Dear Friends,
>      I have a table with 50 lakhs records, the table has more
> then 10 fields, i have primary key, i have select query with
> count(*) without any condition, it takes 17 seconds.

17 seconds to scan 5 million records doesn't sound that bad to me.
Postgresql does not store a count of records, and so it has to actually scan
the table to count all the records.  This was a design choice because select
count(*) isn't usually used in a production system.


>   I have another one query which will do joins with other
> small tables, it takes 47 seconds to give output, the result
> has 2 lakhs records. the indexing is not used.  I have
> created one index with one field ( which i used in this
> query, the field value has duplicates also ).

You should post which version of Postgresql you are using, your table
definition, and the output of EXPLAIN ANALYSE run on your query.  If you
have a lot of IO wait, you are most likely IO bound.  When Postgresql is
using a lot of CPU it is likely performing a sort or hashing.  Pulling a
large number of rows out of an even larger table can be difficult to do
extremely quickly, but if you post the EXPLAIN ANALYZE output we would know
if things could be improved or not.

Dave



pgsql-performance by date:

Previous
From: "Ivan Zolotukhin"
Date:
Subject: Re: PostgreSQL performance on a virtual host
Next
From: "Kevin Grittner"
Date:
Subject: Re: postgresql performance