Re: Very slow table

From: Szymon Guz <mabewlun(at)gmail(dot)com>
To: Richard Weiss <richardweiss(at)richardweiss(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Very slow table
Date: 2011-12-08 08:21:06
Message-ID: CAFjNrYuHyPD+ORNELbVLUTNxEUjf8rXs0C5f305kQVxCnNGdMQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 8 December 2011 06:28, Richard Weiss <richardweiss(at)richardweiss(dot)org>wrote:

> Hi, I am using squeryl, which is based on jdbc, and I am trying to run the
> following statement:
> delete from "Entry" where ("id" = 0)
> but the query never seems to finish. I have tried it in both the program I
> am writing, and the above statement in pgadmin3, and both cases never
> finish.
> Other queries, like
> delete from "Entry" where true
> complete.
>
> The table's initialization statement is:
>
> CREATE TABLE "Entry"
> (
> "pID" bigint NOT NULL,
> id bigint NOT NULL,
> r text NOT NULL,
> CONSTRAINT "Entry_pkey" PRIMARY KEY (id),
> CONSTRAINT "EntryFK21" FOREIGN KEY ("pID")
> REFERENCES "PP" (id) MATCH SIMPLE
> ON UPDATE NO ACTION ON DELETE NO ACTION
> )
> WITH (
> OIDS=FALSE
> );
> ALTER TABLE "Entry" OWNER TO riri;
>
> CREATE INDEX idx2eda05d9
> ON "Entry"
> USING btree
> (id);
>
> Other information:
> Postgres Version: PostgreSQL 8.4.9 on i686-pc-linux-gnu, compiled by GCC
> gcc-4.5.real (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2, 32-bit
>
>
> Thanks, Richard Weiss.
>

Hi Richard,
first of all: table is never slow - a query could be slow. Could you show
us the part of application where you execute the query?
Another reason could be some Postgres locking, check if this query hangs in
pg_stat_activity table. Value 'true' in column 'waiting' means that the
query hangs.
Btw, the index idx2eda05d9 is useless, defining a primary key already
creates an index.
Also show us structure of the table PP, as it must be checked while
deleting rows.

regards
Szymon

--
*http://simononsoftware.com/* <http://simononsoftware.com/>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2011-12-08 11:24:21 Re: Hope for a new PostgreSQL era?
Previous Message Nikhil G. Daddikar 2011-12-08 07:05:21 Error while vacuuming table