Re: Index with all necessary columns - Postgres vs MSSQL

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: Index with all necessary columns - Postgres vs MSSQL
Дата
Msg-id CAHyXU0zwC8bP094Obu8g0wDzGX66ZpA5NJByvEGsfKw2Ck70Vg@mail.gmail.com
обсуждение исходный текст
Ответ на Index with all necessary columns - Postgres vs MSSQL  (Gudmundur Johannesson <gudmundur.johannesson@gmail.com>)
Ответы Re: Index with all necessary columns - Postgres vs MSSQL  (Gudmundur Johannesson <gudmundur.johannesson@gmail.com>)
Список pgsql-performance
On Wed, Feb 1, 2012 at 12:50 PM, Gudmundur Johannesson
<gudmundur.johannesson@gmail.com> wrote:
> Here are the answers to your questions:
> 1) I change the select statement so I am refering to 1 day at a time.  In
> that case the response time is similar.  Basically, the data is not in cache
> when I do that and the response time is about 23 seconds.

what's the difference between the first and the second run time?
Note, if you are only interested in the date the dtStamp falls on, you
can exploit that in the index to knock 4 bytes off your index entry:

CREATE INDEX test_all
  ON test
  USING btree
  (id , (dtstamp::date) , rating);

and then use a similar expression to query it back out.

> 3) The query takes 23 sec vs 1 sec or lower in mssql.

I asked you to time a different query.  Look again (and I'd like to
see cached and uncached times).

> We never update/delete and therefore the data is alway correct in the index
> (never dirty).  Therefore, Postgres could have used the data in it.
>
> I started to add columns into indexes in Oracle for approx 15 years ago and
> it was a brilliant discovery.  This looks like a show stopper for me but I

I doubt covering indexes is going to make that query 23x faster.
However, I bet we can get something worked out.

merlin

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

Предыдущее
От: Alessandro Gagliardi
Дата:
Сообщение: Re: From Simple to Complex
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: From Simple to Complex