pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Giorgio Ponza <giorgio@opla.it>
To: pgsql-general@postgresql.org
Subject: Re: [ADMIN] performance issue using DBI
Date: Thu, 6 Jun 2002 12:47:39 +0200
Message-ID: <0f6e01c20d47$9604eee0$c801a8c0@opla.it> (raw)
References: <F33ednHM3SOlbpH71yE0000b27b@hotmail.com>

i'm not a db expert but i think that a transaction with more than 20.000 operations cant be quick anyway.
I think you have to work in other ways, maybe reading one line at a time, doing the operations, committing, deleting the line from the file.
to remember all this transactions i think postgres must swap more then a 386 with 4MB Ram!
Bye
Giorgio
  ----- Original Message ----- 
  From: Nicolas Nolst 
  To: pgsql-admin@postgresql.org ; pgsql-general@postgresql.org 
  Sent: Thursday, June 06, 2002 11:40 AM
  Subject: [ADMIN] performance issue using DBI


  Hi all,

  I have developped a perl script to populate a database with two tables: sessions
  and actions.

  the table actions contains the following columns: session_id, url, timestamp.
  The column session_id references to the table sessions.

  the table sessions contains the following columns: session_id, remote_ip,
  phone_type, phone_number. The column session_id is serial.

  The lines of the table actions which are part of the same session have the same
  session_id.

  There are then more lines in the table actions than in the table session.


  To fill the two tables, I first need to know if the session already exists for a
  certain phone_type, a certain remote_ip and a certain phone_number:

  SELECT session_id FROM sessions WHERE (phone_number = ?) AND (remote_ip  = ?)
  AND (phone_type = ?) ORDER BY session_id;

  I also need to apply a criteria to know if I have to add a new entry in the
  table sessions or not:

  SELECT (max(timestamp) + ?)<? FROM actions WHERE (session_id = ?);



  If the session already exists I add a line in the table actions with a INSERT

  If the session doesn't exist or if the criteria is true, I add a line in the
  table sessions with an INSERT and then add  a line with a INSERT in the table actions (I use nextval and currval).

  I have put indexes on sessions(session_id), sessions(msisdn),
  actions(session_id) and actions(timestamp). I process one log file of about 20000 lines every day. All the lines are processed in one transaction (autocommit set to 0).

  My problem is that populating my database is slower  when the data gets bigger
  and the performance falls dramatically. I thought that is would be improve with
  my indexes but the problem still persists.

  Could you please give me some clues that could solve this issue.

  Thanks.



  Nicolas Nolst 
   


------------------------------------------------------------------------------
  MSN Photos is the easiest way to share and print your photos: Click Here

view thread (9+ messages)  latest in thread

Message-ID: <0f6e01c20d47$9604eee0$c801a8c0@opla.it>
Permalink:  ../0f6e01c20d47$9604eee0$c801a8c0@opla.it/
Also on:    postgresql.org/message-id/0f6e01c20d47$9604eee0$c801a8c0@opla.it

 · 

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-admin@postgresql.org
  Cc: giorgio@opla.it, pgsql-general@postgresql.org
  Subject: Re: [ADMIN] performance issue using DBI
  In-Reply-To: <0f6e01c20d47$9604eee0$c801a8c0@opla.it>
  References: <F33ednHM3SOlbpH71yE0000b27b@hotmail.com> <0f6e01c20d47$9604eee0$c801a8c0@opla.it>

* 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