Re: quick question abt pg_dump and restore - Mailing list pgsql-general

From Andreas Kretschmer
Subject Re: quick question abt pg_dump and restore
Date
Msg-id 20080109165626.GA21376@KanotixBox
Whole thread Raw
In response to Re: quick question abt pg_dump and restore  ("Josh Harrison" <joshques@gmail.com>)
Responses Re: quick question abt pg_dump and restore
List pgsql-general
Josh Harrison <joshques@gmail.com> schrieb:
> My questions
> 1.  I pg_dumped dummy and Shuffled_dummy (from database1) to another database
> (database2)
> When I issued the query in both database (database1 and database2)
>
> select * from dummy limit 1000 ( the planner chooses seq scan for this query)
> select * from shuffled_dummy limit 1000 (planner chooses seq scan)
>
>
> 2. Also when does the planner switch from choosing index scan to bitmap index
> scan? Is it dependent on the number of rows to be retrieved or the position of
> the relevant data in the blocks or something else?

For a select * ... without a WHERE the db can't use an index, this query
forced a seq-scan.

A index is used when:
- a index are created
- a propper WHERE or ORDER BY in the query
- this index is useful
  (a index isn't useful, for instance, for a small table or when almost
  all rows are in the result set)

A bitmap index scan performed when:
- 2 or more propper indexes available
- see above



Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."    (unknow)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

pgsql-general by date:

Previous
From: "Josh Harrison"
Date:
Subject: Re: quick question abt pg_dump and restore
Next
From: "Scott Marlowe"
Date:
Subject: Re: count(*) and bad design was: Experiences with extensibility