Re: Creating tons of tables to support a query
От | S Dawalt |
---|---|
Тема | Re: Creating tons of tables to support a query |
Дата | |
Msg-id | 00b801c25813$63d8a300$82f96c82@HP0E2E6GKYFJS4 обсуждение исходный текст |
Ответ на | Re: Creating tons of tables to support a query (Stephan Szabo <sszabo@megazone23.bigpanda.com>) |
Ответы |
Re: Creating tons of tables to support a query
Re: Creating tons of tables to support a query |
Список | pgsql-general |
Stephan Szabo said: > > On Sun, 8 Sep 2002, Jan Ploski wrote: > > > I am in particular wondering, why an index on message(sectionID, dateSent) > > does not make these queries comparably fast: > > > > select msgnum from message where > > sectionID = ? and > > dateSent > ? > > order by dateSent > > limit 1; > > I don't think that'll use an index on (sectionID, dateSent) for the sort > step. I think an index on (dateSent,sectionID) might be, however. > I know I've read this before on the list (probably several times). But either my skull is too thick or the topic too abstract; why is no index used for (sectionID, dateSent) but (dateSent, sectionID) does? They are the same columns, but just reversed. I don't see why that would make a difference. Is there some rule-of-thumb for determining when an index is used and when it isn't rather than trail and error using EXPLAIN? Shane
В списке pgsql-general по дате отправления: