pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Arnau <arnaulist@andromeiberica.com>
To: pgsql-performance@postgresql.org
Subject: Advise about how to delete entries
Date: Fri, 02 Sep 2005 13:43:05 +0200
Message-ID: <43183AC9.1060704@andromeiberica.com> (raw)

Hi all,

   I have the following table:

espsm_asme=# \d statistics_sasme
                                           Table "public.statistics_sasme"
           Column          |           Type           | 
          Modifiers
--------------------------+--------------------------+--------------------------------------------------------------
  statistic_id             | numeric(10,0)            | not null default 
nextval('STATISTICS_OPERATOR_ID_SEQ'::text)
  input_message_id         | character varying(50)    |
  timestamp_in             | timestamp with time zone |
  telecom_operator_id      | numeric(4,0)             |
  enduser_number           | character varying(15)    | not null
  telephone_number         | character varying(15)    | not null
  application_id           | numeric(10,0)            |
  customer_id              | numeric(10,0)            |
  customer_app_config_id   | numeric(10,0)            |
  customer_app_contents_id | numeric(10,0)            |
  message                  | character varying(160)   |
  message_type_id          | numeric(4,0)             |
Indexes:
     "pk_stsasme_statistic_id" primary key, btree (statistic_id)
Triggers:
     "RI_ConstraintTrigger_17328735" AFTER INSERT OR UPDATE ON 
statistics_sasme FROM telecom_operators NOT DEFERRABLE INITIALLY 
IMMEDIATE FOR EACH ROW EXECUTE PROCEDURE 
"RI_FKey_check_ins"('fk_stsasme_telecom_operator_id', 
'statistics_sasme', 'telecom_operators', 'UNSPECIFIED', 
'telecom_operator_id', 'telecom_operator_id')
     "RI_ConstraintTrigger_17328738" AFTER INSERT OR UPDATE ON 
statistics_sasme FROM applications NOT DEFERRABLE INITIALLY IMMEDIATE 
FOR EACH ROW EXECUTE PROCEDURE 
"RI_FKey_check_ins"('fk_stsasme_application_id', 'statistics_sasme', 
'applications', 'UNSPECIFIED', 'application_id', 'application_id')
     "RI_ConstraintTrigger_17328741" AFTER INSERT OR UPDATE ON 
statistics_sasme FROM customers NOT DEFERRABLE INITIALLY IMMEDIATE FOR 
EACH ROW EXECUTE PROCEDURE "RI_FKey_check_ins"('fk_stsasme_customer_id', 
'statistics_sasme', 'customers', 'UNSPECIFIED', 'customer_id', 
'customer_id')


That contains about 7.000.000 entries and I have to remove 33.000 
entries. I have created an sql file with all the delete sentences, e.g.:

    "DELETE FROM statistics_sasme WHERE statistic_id = 9832;"

then I do \i delete_items.sql. Remove a single entry takes more than 10 
seconds. What would you do to speed it up?

Thank you very much




view thread (6+ messages)  latest in thread

Message-ID: <43183AC9.1060704@andromeiberica.com>
Permalink:  ../43183AC9.1060704@andromeiberica.com/
Also on:    postgresql.org/message-id/43183AC9.1060704@andromeiberica.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: arnaulist@andromeiberica.com
  Subject: Re: Advise about how to delete entries
  In-Reply-To: <43183AC9.1060704@andromeiberica.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