Re: Optimizing Query

Поиск
Список
Период
Сортировка
От Michael Fork
Тема Re: Optimizing Query
Дата
Msg-id Pine.BSI.4.21.0103051753220.17564-100000@glass.toledolink.com
обсуждение исходный текст
Ответ на Re: Optimizing Query  (Justin Long <justinlong@strategicnetwork.org>)
Список pgsql-sql
Did you run VACUUM ANALYZE after running CLUSTER?

Michael Fork - CCNA - MCP - A+
Network Support - Toledo Internet Access - Toledo Ohio

On Mon, 5 Mar 2001, Justin Long wrote:

> Ok, now I have another question... it doesn't seem to be accessing the index.
> 
> explain select k.kbid,k.title from knowledge k , kbwords w0 , kbwords w1 
> WHERE ((k.kbid=w0.kbid and w0.wordid=42743) AND (k.kbid=w1.kbid and 
> w1.wordid=85369))
> 
> NOTICE:  QUERY PLAN:
> 
> Merge Join  (cost=32339.30..35496.97 rows=19262538 width=24)
>    ->  Merge Join  (cost=16530.24..16668.77 rows=233274 width=20)
>          ->  Sort  (cost=15809.06..15809.06 rows=8257 width=4)
>                ->  Seq Scan on kbwords w1  (cost=0.00..15271.85 rows=8257 
> width=4)
>          ->  Sort  (cost=721.18..721.18 rows=2825 width=16)
>                ->  Seq Scan on knowledge k  (cost=0.00..559.25 rows=2825 
> width=16)
>    ->  Sort  (cost=15809.06..15809.06 rows=8257 width=4)
>          ->  Seq Scan on kbwords w0  (cost=0.00..15271.85 rows=8257 width=4)
> 
> Note the sequential scans... there is a wordindex where w0.wordid=42743... 
> why isn't it doing an indexscan? wouldn't that be more efficient?
> 
> Justin
> 
> 
> At 04:45 PM 3/5/2001 -0500, you wrote:
> >Yes.
> >
> > > On Mon, Mar 05, 2001 at 04:07:57PM -0500, Bruce Momjian allegedly wrote:
> > > > Have you tried VACUUM ANALYZE and CLUSTER?
> > >
> > > I assume CLUSTER still drops all indexes except the one you're clustering
> > > on?
> > >
> > > Mathijs
> > > --
> > > It's not that perl programmers are idiots, it's that the language
> > > rewards idiotic behavior in a way that no other language or tool has
> > > ever done.
> > >                                                     Erik Naggum
> > >
> >
> >
> >--
> >   Bruce Momjian                        |  http://candle.pha.pa.us
> >   pgman@candle.pha.pa.us               |  (610) 853-3000
> >   +  If your life is a hard drive,     |  830 Blythe Avenue
> >   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
> 
> 
> ____________________________________________________________________
> Justin Long                                     Network for Strategic Missions
> justinlong@strategicnetwork.org 1732 South Park Court
> http://www.strategicnetwork.org Chesapeake, VA 23320, USA
> Reality Check e-zine: reality-check-subscribe@yahoogroups.com
> ____________________________________________________________________
> Law: Never retreat. Never surrender. Never cut a deal with a dragon.
> Corollary: No armor? Unclean life? Then do not mess in the affairs
> of dragons, for you are crunchy and taste good with ketchup.
> 



В списке pgsql-sql по дате отправления:

Предыдущее
От: Grant
Дата:
Сообщение: How to count elements in an array?
Следующее
От: Mathijs Brands
Дата:
Сообщение: Re: Two way encryption in PG???