Re: Index usage on OR queries
| От | Andy Colson |
|---|---|
| Тема | Re: Index usage on OR queries |
| Дата | |
| Msg-id | 4E5E4BB8.3050209@squeakycode.net обсуждение исходный текст |
| Ответ на | Re: Index usage on OR queries (Tore Halvorsen <tore.halvorsen@gmail.com>) |
| Список | pgsql-general |
On 8/31/2011 9:53 AM, Tore Halvorsen wrote: > On Wed, Aug 31, 2011 at 4:49 PM, Andy Colson <andy@squeakycode.net > <mailto:andy@squeakycode.net>> wrote: > > On PG 9, after I ANALYZED the tables, it used indexes: > > > QUERY PLAN > ------------------------------__------------------------------__------------------------------__--------------------- > Merge Join (cost=1.59..82778.35 rows=13171 width=20) (actual > time=0.066..1076.616 rows=12966 loops=1) > Merge Cond: (a.id <http://a.id> = b.id <http://b.id>) > Join Filter: ((a."time" >= '2011-08-15 00:00:00'::timestamp > without time zone) OR (b."time" >= '2011-08-01 0 > -> Index Scan using a_pkey on a (cost=0.00..31389.36 > rows=1000000 width=12) (actual time=0.007..204.856 ro > -> Index Scan using b_pkey on b (cost=0.00..31389.36 > rows=1000000 width=12) (actual time=0.006..224.189 ro > > > ANALYZE is the magic. > > > You are, of course, right, but it doesn't use the TIME index. > Hmmm, may be my example isn't large enough to produce the issue. > > -- > Eld på åren og sol på eng gjer mannen fegen og fjåg. [Jøtul] > <demo> 2011 Tore Halvorsen || +052 0553034554 wow, yea.. I saw index and just assumed. Didn't even notice, sorry about that. -Andy
В списке pgsql-general по дате отправления: