voodoo index usage ;)
От | D. Duccini |
---|---|
Тема | voodoo index usage ;) |
Дата | |
Msg-id | Pine.GSO.4.03.10103171332200.20307-100000@ra.bpsi.net обсуждение исходный текст |
Ответ на | Re: Indexes not used (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: voodoo index usage ;)
|
Список | pgsql-novice |
perhaps the db gawds can explain this.... # \d radusage Table "radusage" Attribute | Type | Modifier -----------+-------------+---------- datetime | timestamp | not null account | varchar(64) | usage | integer | sent | integer | recv | integer | ip | bigint | host | bigint | port | smallint | Indices: idxradaccount, idxraddate, idxradoid # \d idxradaccount Index "idxradaccount" Attribute | Type -----------+------------- account | varchar(64) btree # \d idxraddate Index "idxraddate" Attribute | Type -----------+----------- datetime | timestamp btree # explain select * from radusage where account = 'someuser'; NOTICE: QUERY PLAN: Seq Scan on radusage (cost=0.00..13870.80 rows=5674 width=50) and if i add in datetime (without effectively changing the semantic meaning of the search) # explain select * from radusage where account = 'someuser' and datetime > '1900-01-01'; NOTICE: QUERY PLAN: Index Scan using idxradaccount on radusage (cost=0.00..15295.37 rows=5668 width=50) first case doesn't use the index, the second does use what would seem to be the correct index isn't that wacky???? -duck ----------------------------------------------------------------------------- david@backpack.com BackPack Software, Inc. www.backpack.com +1 651.645.7550 voice "Life is an Adventure. +1 651.645.9798 fax Don't forget your BackPack!" -----------------------------------------------------------------------------
В списке pgsql-novice по дате отправления: