Re: [PERFORM] estimated rows vs. actual rows

2005-02-14 Thread Christopher Browne
After takin a swig o' Arrakan spice grog, [EMAIL PROTECTED] (Jaime Casanova) belched out: > On Sun, 13 Feb 2005 13:41:09 -0800, Josh Berkus wrote: >> Jaime, >> >> > Why is this query using a seq scan rather than a index scan? >> >> Because it thinks a seq scan will be faster. >> > I will sugge

Re: [PERFORM] estimated rows vs. actual rows

2005-02-13 Thread Mark Kirkwood
Jaime Casanova wrote: But, IMHO, if the table has 143902 and it thinks will retrieve 2610 (almost 1.81% of the total). it won't be faster with an index? Depends on how those 2610 rows are distributed amongst the 143902. The worst case scenario is each one of them in its own page. In that case you

Re: [PERFORM] estimated rows vs. actual rows

2005-02-13 Thread Tom Lane
Jaime Casanova <[EMAIL PROTECTED]> writes: > But, IMHO, if the table has 143902 and it thinks will retrieve 2610 > (almost 1.81% of the total). it won't be faster with an index? That's almost one row in fifty. We don't know how wide the table is, but it's certainly possible that there are order-o

Re: [PERFORM] estimated rows vs. actual rows

2005-02-13 Thread Jaime Casanova
On Sun, 13 Feb 2005 13:41:09 -0800, Josh Berkus wrote: > Jaime, > > > Why is this query using a seq scan rather than a index scan? > > Because it thinks a seq scan will be faster. > I will suggest him to probe with seq scans disabled. But, IMHO, if the table has 143902 and it thinks will retri

Re: [PERFORM] estimated rows vs. actual rows

2005-02-13 Thread Josh Berkus
Jaime, > Why is this query using a seq scan rather than a index scan? Because it thinks a seq scan will be faster. > i notice > the diff between the estimated rows and actual rows (almost 2000). Yes, ANALYZE, and possibly increasing the column stats, should help that. > Can this affect the q

[PERFORM] estimated rows vs. actual rows

2005-02-13 Thread Jaime Casanova
Hi, in the #postgresql-es channel someone shows me this: pgsql-7.4.5 + postgis --- begin context --- CREATE TABLE calles ( gid int4 NOT NULL DEFAULT nextval('public.callesstgo_gid_seq'::text), nombre varchar, inicio int4, termino int4, comuna varchar, ciudad varchar, region numer