Re: Why DISTINCT ... DESC is slow?

Поиск
Список
Период
Сортировка
От Ron Johnson
Тема Re: Why DISTINCT ... DESC is slow?
Дата
Msg-id 45800737.3050103@cox.net
обсуждение исходный текст
Ответ на Re: Why DISTINCT ... DESC is slow?  (Anton <anton200@gmail.com>)
Список pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/12/06 23:13, Anton wrote:
[snip]
>> Why do you have indexes on both LOGIN_ID *and* LOGIN_ID +
>> COLLECT_TIME?
> It is because I think that queries which use only LOGIN_ID field
> will use (faster) LOGIN_IDonly index... For me, speed of
> insertions is not a primary task here (robot is not confused by
> delays...), but select is. So I keep both indexes.

Figured.  Understandable thought, and valid for a *hashed* index.
Also valid for COLLECT_TIME, since it's the 2nd segment of the index.

Because of the nature of b-tree indexes, though, the optimizer
*will* use n_traffic_login_id_collect_time when you say WHERE
LOGIN_ID = 5;

>> ISTM that you can drop the LOGIN_ID index.


- --
Ron Johnson, Jr.
Jefferson LA  USA

Is "common sense" really valid?
For example, it is "common sense" to white-power racists that
whites are superior to blacks, and that those with brown skins
are mud people.
However, that "common sense" is obviously wrong.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFFgAc3S9HxQb37XmcRAnGPAKCgRBJ1ADJ/chYqIDZhVdZhwKB6YQCeNevb
+DnTXM/8utMXyN5s+zA//lU=
=DKb/
-----END PGP SIGNATURE-----

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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: grant select on all tables of schema or database
Следующее
От: "Merlin Moncure"
Дата:
Сообщение: Re: PG Admin