Re: Ideas to deal with table corruption

2018-01-06 Thread Rui DeSousa
Correct, and there is no need to create an index on a unique constraint or primary key as they are already implemented via indexes. I can’t count how many duplicate indexes I’ve dropped in the past. I use this view help find duplicates in a given system. Duplicate indexes just use up space an

Re: Ideas to deal with table corruption

2018-01-06 Thread scott ribe
On Jan 6, 2018, at 12:11 PM, Corey Taylor wrote: > Is it possible for an index to not exist on those columns? > > https://www.postgresql.org/docs/current/static/ddl-constraints.html#DDL-CONSTRAINTS-FK > > "A foreign key must reference columns that either are a primary key or form a > unique con

Re: Ideas to deal with table corruption

2018-01-06 Thread Corey Taylor
On Sat, Jan 6, 2018 at 12:30 PM, Melvin Davidson wrote: > > *Don't forget to create indexes on the FK's in the table they reference!* > > > *Also, it would be nice to know the PostgreSQL version and O/S.* > Is it possible for an index to not exist on those columns? https://www.postgresql.org/d

Re: Ideas to deal with table corruption

2018-01-06 Thread Melvin Davidson
On Sat, Jan 6, 2018 at 1:23 PM, Peter Geoghegan wrote: > On Sat, Jan 6, 2018 at 2:11 AM, Luis Marin > wrote: > > I am looking for ideas, to help me, check what is happening with a > possible > > table corruption, I have some FK that works ok, but some stay in the > state > > waiting forever, ho

Re: Ideas to deal with table corruption

2018-01-06 Thread Peter Geoghegan
On Sat, Jan 6, 2018 at 2:11 AM, Luis Marin wrote: > I am looking for ideas, to help me, check what is happening with a possible > table corruption, I have some FK that works ok, but some stay in the state > waiting forever, however selecting the same table works fine. > > Since, I am a newbie, in

Re: Ideas to deal with table corruption

2018-01-06 Thread Rui DeSousa
How large are the given tables and is the databases in heavy use at the time? It sounds like either blocking is occurring or you’re dealing with large tables and the validation is take a long time; which, in both case is normal. Try creating the foreign key without validation, i.e. use the “not

Re: Ideas to deal with table corruption

2018-01-06 Thread Adrian Klaver
On 01/06/2018 02:11 AM, Luis Marin wrote: Dear community, I am looking for ideas, to help me, check what is happening with a possible  table corruption, I  have some FK that works ok, but some stay in the state waiting forever, however selecting the same table works fine. From further comme

Ideas to deal with table corruption

2018-01-06 Thread Luis Marin
Dear community, I am looking for ideas, to help me, check what is happening with a possible table corruption, I have some FK that works ok, but some stay in the state waiting forever, however selecting the same table works fine. Since, I am a newbie, in PostgreSQL, what should be my firsts step