Re: BUG #2953: index scan, feature request

Поиск
Список
Период
Сортировка
От Magnus Hagander
Тема Re: BUG #2953: index scan, feature request
Дата
Msg-id 20070202081318.GB20955@svr2.hagander.net
обсуждение исходный текст
Ответ на Re: BUG #2953: index scan, feature request  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On Thu, Feb 01, 2007 at 09:17:51PM -0500, Tom Lane wrote:
> "michael" <miblogic@yahoo.com> writes:
> > can these be executed with index seek like what MS SQL does?
> > select * from account_category
> > where account_category_full_description <> 'MICHAEL'
>
> What for?  A query like that is generally going to fetch the majority of
> the table, so an indexscan would be counterproductive.
>
> It could potentially be a win if a very large fraction of the rows had
> the exact value MICHAEL ... but the recommended way to deal with that is
> to create a partial index with "full_description <> 'MICHAEL'" as the
> WHERE clause.

Just FYI, the reason that MSSQL does this is most likely that you have a
covering, clustered index on that column. First of all, if you have a
clustered index on that table, SQLServer wil always do an indexscan -
because there is no way to heap-scan such a table. And second, since
SQLServer has covering indexes, they can use indexes in cases where it
returns even a significant portion of the table.

//Magnus

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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: BUG #2952: where is the user guide
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: "Julian day" date format is off by 12 hours