Re: Rows missing from table despite FK constraint

From: Konrad Garus <konrad(dot)garus(at)gmail(dot)com>
To: Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Rows missing from table despite FK constraint
Date: 2010-01-11 11:30:32
Message-ID: 6645f6441001110330s29e67d29t46f9e29fc011bd9c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2010/1/8 Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>:

> Did you turn off seqscans in the postgres.conf?

Seq scan is enabled.

> Could you try a "REINDEX TABLE attachment" again in case you somehow reindexed the wrong index or table?

How about this test?

On a dump from before the rows were gone:

# select count(*) from attachment where when_uploaded < '2010-01-01';
count
----------
22523642
(1 row)

On production database:

# explain select count(*) from attachment where when_uploaded < '2010-01-01';
QUERY PLAN
--------------------------------------------------------------------------------------
Aggregate (cost=1794931.20..1794931.21 rows=1 width=0)
-> Seq Scan on attachment (cost=0.00..1738076.24 rows=22741985 width=0)
Filter: (when_uploaded < '2010-01-01 00:00:00'::timestamp
without time zone)
(3 rows)

# select count(*) from attachment where when_uploaded < '2010-01-01';
count
----------
22523639
(1 row)

--
Konrad Garus

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2010-01-11 11:35:56 Re: R: aggregate over tables in different schema
Previous Message hubert depesz lubaczewski 2010-01-11 11:24:24 Re: Table appears on listing but can't drop it