Обсуждение: RHDB just sits and does nothing?

Поиск
Список
Период
Сортировка

RHDB just sits and does nothing?

От
"Mauri Sahlberg"
Дата:
Hi,

What an earth I am doing wrong? I am trying to delete about 6500 rows and
I am the only user connected to the database and it just sits there and
does nothing?

rahaks=# select count(*) from tilikartta where yritys=18231413;
 count
-------
  6347
(1 row)

rahaks=# explain delete from tilikartta where yritys=18231413;
                          QUERY PLAN
--------------------------------------------------------------
 Seq Scan on tilikartta  (cost=0.00..500.23 rows=249 width=6)
   Filter: (yritys = 18231413)
(2 rows)

rahaks=# begin foo
rahaks-# ;
ERROR:  parser: parse error at or near "foo" at character 7
rahaks=# begin;
BEGIN
rahaks=# set constraints all deferred;
SET CONSTRAINTS
rahaks=# delete from tilikartta where yritys=18231413;

Logs are fed to syslog and there I can see the following:
Jun  9 10:02:11 pihsi postgres[31547]: [19] LOG:  query: select count(*)
from tilikartta where yritys=18231413;
Jun  9 10:02:11 pihsi postgres[31547]: [20] LOG:  duration: 0.041401 sec
Jun  9 10:02:33 pihsi postgres[31547]: [21] LOG:  query: explain delete
from tilikartta where yritys=18231413;
Jun  9 10:02:33 pihsi postgres[31547]: [22] LOG:  duration: 0.000781 sec
Jun  9 10:02:41 pihsi postgres[31547]: [23] LOG:  query: begin foo
Jun  9 10:02:41 pihsi postgres[31547]: [24] ERROR:  parser: parse error at
or near "foo" at character 7
Jun  9 10:02:44 pihsi postgres[31547]: [25] LOG:  query: begin;
Jun  9 10:02:44 pihsi postgres[31547]: [26] LOG:  duration: 0.000181 sec
Jun  9 10:02:51 pihsi postgres[31547]: [27] LOG:  query: set constraints
all deferred;
Jun  9 10:02:51 pihsi postgres[31547]: [28] LOG:  duration: 0.000205 sec
Jun  9 10:03:04 pihsi postgres[31547]: [29] LOG:  query: delete from
tilikartta where yritys=18231413;

It is now 10:09 local time and it still sits there and does nothing?

           Table "public.tilikartta"
   Column   |          Type          | Modifiers
------------+------------------------+-----------
 numero     | integer                | not null
 tililaji   | smallint               | not null
 kielikoodi | smallint               | not null
 yritys     | integer                | not null
 selite     | character varying(255) | not null
 tilimalli  | character varying(255) |
Indexes: pk_tilikartta primary key btree (numero, tililaji, kielikoodi,
yritys)
Foreign Key constraints: fk_tilikartta_yritys FOREIGN KEY (yritys)
REFERENCES yritys(numero) ON UPDATE NO ACTION ON DELETE NO ACTION,
                         fk_tilikartta_tilikarttamallit FOREIGN KEY
(tilimalli) REFERENCES tilikarttamallit(nimi) ON
UPDATE NO ACTION ON DELETE NO ACTIO

psql (PostgreSQL) 7.3.6-RH
contains support for command-line editing

rh-postgresql-server-7.3.6-1


Re: RHDB just sits and does nothing?

От
Stephan Szabo
Дата:
On Wed, 9 Jun 2004, Mauri Sahlberg wrote:

> rahaks=# begin foo
> rahaks-# ;
> ERROR:  parser: parse error at or near "foo" at character 7
> rahaks=# begin;
> BEGIN
> rahaks=# set constraints all deferred;
> SET CONSTRAINTS

In addition to the other messages, the above only defers deferrable
constraints.  If you didn't specify initially deferred or deferrable when
creating the fk constraint, the above will not affect it.