pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Martijn van Oosterhout <kleptog@svana.org>
To: roopa perumalraja <roopabenzer@yahoo.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Performance Problem
Date: Fri, 13 Oct 2006 10:22:10 +0200
Message-ID: <20061013082210.GE1896@svana.org> (raw)
In-Reply-To: <20061013052628.7600.qmail@web50802.mail.yahoo.com>
References: <20061013052628.7600.qmail@web50802.mail.yahoo.com>

On Thu, Oct 12, 2006 at 10:26:28PM -0700, roopa perumalraja wrote:
> I am new to postgres and I have 4 doubts.
>    
>   1) I have a performance problem as I am trying to insert around 60
>   million rows to a table which is partitioned. So first I copied the
>   .csv file which contains data, with COPY command to a temp table
>   which was quick. It took only 15 to 20 minutes. Now I am inserting
>   data from temp table to original table using insert into org_table
>   (select * from temp_table); which is taking more than an hour & is
>   still inserting. Is there an easy way to do this?

Does the table you're inserting into have indexes or foreign keys?
Either of those slow down loading considerably. One commen workaround
is to drop the indexes and constraints, load the data and re-add them.

>   2) I want to increase the performance of database as I find it very
>   slow which has more than 60 million rows in one table. I increased
>   the shared_buffer parameter in postgres.conf file to 20000 but that
>   does help much.

Find out the queries that are slow and use EXPLAIN to identify possible
useful indexes.

>   2) I have partitioned a parent table into 100 child tables so when
>   I insert data to parent table, it automatically inserts to child
>   table. I have followed
>   http://www.postgresql.org/docs/8.1/interactive/ddl-partitioning.html.
>   When I did this, I noticed that when I viewed data of parent table,
>   it had the rows of the child table and is not empty. But the child
>   tables do have the rows in it. I don’t understand.

When you select from a parent table, it shows the rows of the child
tables also, that's kind of the point. You can say: SELECT * FROM ONLY
parent;

The partitioning may only explain the slow loading...

>   3) I want to use materialized views, I don’t understand it from
>   http://jonathangardner.net/PostgreSQL/materialized_views/matviews.html,
>   can anyone explain me with a simple example.

Can't help you there...

Have a nice day,
-- 
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachments:

  signature.asc (application/pgp-signature, 188B) download

view thread (47+ messages)  latest in thread

Message-ID: <20061013082210.GE1896@svana.org>
Permalink:  ../20061013082210.GE1896@svana.org/
Also on:    postgresql.org/message-id/20061013082210.GE1896@svana.org

 · 

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-general@postgresql.org
  Cc: kleptog@svana.org, roopabenzer@yahoo.com
  Subject: Re: Performance Problem
  In-Reply-To: <20061013082210.GE1896@svana.org>
  References: <20061013052628.7600.qmail@web50802.mail.yahoo.com> <20061013082210.GE1896@svana.org>

* 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