I think that's because the stream=1 query is doing a sequential scan on
files, so it has to look at everything, whereas the index scan in the
stream=2 query only looks at the important rows. (Which in this case was
just 1 row.)
I think this question is: why is one using an index scan and the other
using a sequential scan?
On Fri, 9 Mar 2001, Stephan Szabo wrote:
>
> Hmm, I also notice that it's getting very different numbers for
> rows from files as well.
>
> On Fri, 9 Mar 2001, Ben wrote:
>
> > Every night. There are 6223 rows with stream=2 and 7041 rows with
> > stream=1. At any given time, there will be between 1 to 30 rows with
> > played=null for both values.
> >
> > On Fri, 9 Mar 2001, Stephan Szabo wrote:
> >
> > >
> > > Has vacuum analyze been run on both recently? What is the maximum number
> > > of rows with a particular stream value, and how many does each of 1 and 2
> > > actually have?
> > >
> > > > Interestingly, the sequential scan on playlist claims to be returning 2000
> > > > results for stream=1 and only 200 for stream=2. I'm not sure which part of
> > > > the where clause this guess comes from, because the playlist table has
> > > > equal numbers of entries for both streams.
>
>