Advise about how to delete entries

Поиск
Список
Период
Сортировка
От Arnau
Тема Advise about how to delete entries
Дата
Msg-id 43183AC9.1060704@andromeiberica.com
обсуждение исходный текст
Ответы Re: Advise about how to delete entries  (Michael Fuhr <mike@fuhr.org>)
Re: Advise about how to delete entries  (PFC <lists@boutiquenumerique.com>)
Список pgsql-performance
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


В списке pgsql-performance по дате отправления:

Предыдущее
От: Alex Stapleton
Дата:
Сообщение: Re: Avoid using swap in a cluster
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: ORDER BY and LIMIT not propagated on inherited