| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Sim Zacks <sim(at)compulab(dot)co(dot)il> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: reindex |
| Date: | 2009-12-23 15:21:17 |
| Message-ID: | 14859.1261581677@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Sim Zacks <sim(at)compulab(dot)co(dot)il> writes:
> I have an aggregate table which is constantly being overwritten. Every
> 10 minutes or so, the table is erased and populated with new data, most
> of which is the same.
> Basically a materialized view.
> I have been going through some queries that use this table and noticed
> that the explain looked different from our test database (a backup of
> the prod db) which has the same number of rows and the same type of
> data. vacuum analyze did not change anything.
> One specific difference I noticed was that it was doing a sequential
> scan instead of an index scan.
> reindex table changed the prod one to look like the test one.
Are you vacuuming each time you erase-and-repopulate?
The truncate approach might work too, but it would depend on whether you
can lock out all access to the table while you refill it.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Christine Penner | 2009-12-23 17:03:01 | Simple function |
| Previous Message | Pau Marc Munoz Torres | 2009-12-23 14:22:45 | Re: Drop/ Alter index if exist |