Re: Creating Index

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "CN" <cnliou9(at)fastmail(dot)fm>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Creating Index
Date: 2003-10-01 15:58:20
Message-ID: 29756.1065023900@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"CN" <cnliou9(at)fastmail(dot)fm> writes:
> The following view is, again, a simplified version. The real version,
> which takes 13 seconds, joins 2 more tables.

You're really doing your best to make sure we don't figure out what's
going on :-(

One thing I can see from your EXPLAIN ANALYZE results, though, is that
you've never VACUUMed or ANALYZEd these tables. If you had, there'd
be something other than the default 1000-row table size estimates:

> -> Index Scan using table1_pkey on table1
> (cost=0.00..52.00 rows=1000 width=100)
> (actual time=0.69..220.87 rows=9428 loops=1)
> -> Index Scan using table2_pkey on table2
> (cost=0.00..52.00 rows=1000 width=224)
> (actual time=0.63..959.95 rows=28482 loops=1)

and possibly the planner would have picked a more appropriate plan.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Rod Taylor 2003-10-01 16:08:37 Re: Creating Index
Previous Message Richard Huxton 2003-10-01 15:43:39 Re: Link Oracle tables in Postgre