From: | Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Why DISTINCT ... DESC is slow? |
Date: | 2006-12-13 13:59:19 |
Message-ID: | 45800737.3050103@cox.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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-----
From | Date | Subject | |
---|---|---|---|
Next Message | Merlin Moncure | 2006-12-13 14:04:52 | Re: PG Admin |
Previous Message | Martijn van Oosterhout | 2006-12-13 13:50:40 | Re: grant select on all tables of schema or database |