"DELETE FROM statistics_sasme WHERE statistic_id = 9832;"

As Michael said, why use a NUMERIC when a bigint is faster and better for your use case, as you only need an integer and not a fixed precision decimal ?

Also if you use postgres < 8, the index will not be used if you search on a type different from the column type. So, if your key is a bigint, you should do WHERE statistic_id = 9832::bigint.

For mass deletes like this, you should use one of the following, which will be faster :

        DELETE FROM ... WHERE ID IN (list of values)
Don't put the 30000 values in the same query, but rather do 300 queries with 100 values in each.

COPY FROM a file with all the ID's to delete, into a temporary table, and do a joined delete to your main table (thus, only one query).

        EXPLAIN DELETE is your friend.

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to