Re: index problem

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: CoL <col(at)mportal(dot)hu>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: index problem
Date: 2001-10-16 22:56:22
Message-ID: Pine.BSF.4.21.0110161548400.18471-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, 16 Oct 2001, CoL wrote:

> ---------------------------
> The 2 table query, where prog_data has ~8800 rowsn and index on prog_id:
> bash-2.04$ time echo "explain select distinct
> prog_id,prog_ftype,prog_fcasthour,prog_date from prog_dgy_xy,prog_data
> where pxygy_pid=prog_id " | psql -Uuser db
> NOTICE: QUERY PLAN:
>
> Unique (cost=7432549.69..7680455.07 rows=2479054 width=32)
> -> Sort (cost=7432549.69..7432549.69 rows=24790538 width=32)
> -> Merge Join (cost=148864.65..161189.33 rows=24790538 width=32)
> -> Index Scan using prog_data_pkey on prog_data
> (cost=0.00..701.12 rows=8872 width=28)
> -> Sort (cost=148864.65..148864.65 rows=921013 width=4)
> -> Seq Scan on prog_dgy_xy (cost=0.00..30145.13
> rows=921013 width=4)

I'm guessing that the approximately 25 million row estimate on the join
has to be wrong as well given that prog_data.prog_id should be unique.

Hmm, does the explain change if you vacuum analyze the other table
(prog_data)? If not, what does explain show if you do a
set enable_seqscan='off';
before it?

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Marc G. Fournier 2001-10-17 00:27:19 Re: Why are ftp mirrors out of sync?
Previous Message Tom Lane 2001-10-16 21:36:08 Re: Triggers do not fire