Re: quick question abt pg_dump and restore

From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: quick question abt pg_dump and restore
Date: 2008-01-09 16:56:26
Message-ID: 20080109165626.GA21376@KanotixBox
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Josh Harrison <joshques(at)gmail(dot)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°

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2008-01-09 17:03:59 Re: count(*) and bad design was: Experiences with extensibility
Previous Message Josh Harrison 2008-01-09 16:51:16 Re: quick question abt pg_dump and restore