Re: [HACKERS] Neverending query on 6.5.2 over Solaris 2.5.1

From: Fernando Schapachnik <fpscha(at)ns1(dot)via-net-works(dot)net(dot)ar>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane)
Cc: fpscha(at)via-net-works(dot)net(dot)ar, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Neverending query on 6.5.2 over Solaris 2.5.1
Date: 1999-10-23 18:29:01
Message-ID: 199910231829.PAA13176@ns1.via-net-works.net.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

En un mensaje anterior, Tom Lane escribió:
> I wrote:
> > Weird. I assume that your 'activa' field is 'bool'? I've been trying
> > to duplicate this misbehavior here, and as near as I can tell the system
> > handles selectivity estimates for boolean fields just fine. Whatever
> > percentage of 't' values was seen by the last VACUUM ANALYZE is exactly
> > what it uses.
>
> On second thought: 6.5.* can get confused if the column contains more
> NULLs than anything else. Dunno if you have a lot of nulls in activa,
> but if so you might try changing them all to explicit 'f' and then
> redoing the VACUUM ANALYZE. Next release will be smarter about keeping
> stats in the presence of many nulls.
>
> It'd be useful to double-check my theory that the system is
> misestimating the selectivity of the WHERE (u.activa) clause.
> You could try this:
> SELECT count(*) FROM usarios WHERE activa;

10571

> EXPLAIN SELECT count(*) FROM usarios WHERE activa;
> and see how far off the row count estimate in the EXPLAIN is
> from reality.

NOTICE: QUERY PLAN:

Aggregate (cost=498.84 rows=1 width=4)
-> Seq Scan on usuarios (cost=498.84 rows=1 width=4)

EXPLAIN

Don't hesitate in asking any other info/test you may consider useful.

Regards!

Fernando P. Schapachnik
Administración de la red
VIA Net Works Argentina SA
Diagonal Roque Sáenz Peña 971, 4º y 5º piso.
1035 - Capital Federal, Argentina.
(54-11) 4323-3333
http://www.via-net-works.net.ar

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message The Hermit Hacker 1999-10-23 19:23:57 Re: [ADMIN] Re: [HACKERS] RFC: Industrial-strength logging (long message)
Previous Message Fernando Schapachnik 1999-10-23 18:25:25 Re: [HACKERS] Neverending query on 6.5.2 over Solaris 2.5.1