Re: INDEX suggestion needed

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: Thomas Beutin <tyrone(at)laokoon(dot)IN-Berlin(dot)DE>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: INDEX suggestion needed
Date: 2002-12-12 15:50:48
Message-ID: r9bhvug5revknk0iidlrilk91igvkntmot@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 12 Dec 2002 15:33:11 +0100, Thomas Beutin
<tyrone(at)laokoon(dot)IN-Berlin(dot)DE> wrote:
> AND ( visit >= '2002-12-01' OR visit <= '2002-12-11');
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is logically equivalent to (visit IS NOT NULL), I guess you want
AND, not OR.

> -> Seq Scan on stat_pages (cost=0.00..13821.19 rows=343520 width=34)
>
>Is there any hope left? ;-)

Please show us the output of
VACUUM VERBOSE ANALYZE stat_pages;

EXPLAIN ANALYZE
SELECT COUNT(DISTINCT a_id)
FROM stat_pages
WHERE m_id = 35::smallint
AND (visit >= '2002-12-01' AND visit <= '2002-12-11');

SELECT attname, null_frac, avg_width, n_distinct,
most_common_vals, histogram_bounds, correlation
FROM pg_stats
WHERE tablename = 'stat_pages'
AND attname IN ('m_id', 'visit');

Servus
Manfred

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Johnson, Shaunn 2002-12-12 16:12:25 installing with readline
Previous Message Bruce Momjian 2002-12-12 15:38:45 Re: Recovery Mode