Re: Multiple indexes, huge table - Mailing list pgsql-general

From Jeff Janes
Subject Re: Multiple indexes, huge table
Date
Msg-id CAMkU=1wTB0HBFcbO40ANuYBV7amVp4iBqn8v1=XT4F8UNwbsnQ@mail.gmail.com
Whole thread Raw
In response to Re: Multiple indexes, huge table  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Multiple indexes, huge table
Re: Multiple indexes, huge table
List pgsql-general
>
>> There are also rare cases where I might want to make a correction.  For example, one of the columns is sample name
whichis a foreign key to a samples table defined with " ON UPDATE CASCADE."  I decided to change a sample name in the
samplestable which should affect about 20 million rows out of the previously mentioned 500 million.  That query has now
beenrunning for five days and isn't finished yet. 
>
> That sounds like you lack an index on the referencing column of the
> foreign key constraint.  Postgres doesn't require you to keep such
> an index, but it's a really good idea if you ever update the referenced
> column.

For updating 20 million out of 500 million rows, wouldn't a full table
scan generally be preferable to an index scan anyway?

But, if he doesn't drop those other indexes during this process, the
maintenance on them is going to kill his performance anyway, just like
it does for bulk loading.  If you figure 20,000,000 * (1 table + 5
index) / 15,000 rpm, it comes out to around 5 days.

Cheers,

Jeff


pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: PostgreSQL server embedded in NAS firmware?
Next
From: Adrian Klaver
Date:
Subject: Re: PostgreSQL server embedded in NAS firmware?