From: | Tore Halvorsen <tore(dot)halvorsen(at)gmail(dot)com> |
---|---|
To: | Andy Colson <andy(at)squeakycode(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Index usage on OR queries |
Date: | 2011-08-31 14:53:54 |
Message-ID: | CADGw-SfxUXJNM3wN9oXNcST=u1-qvXz8nt=zS-sVOt0M2iKnjg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Aug 31, 2011 at 4:49 PM, Andy Colson <andy(at)squeakycode(dot)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 = 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
From | Date | Subject | |
---|---|---|---|
Next Message | Andy Colson | 2011-08-31 14:56:56 | Re: Index usage on OR queries |
Previous Message | Andy Colson | 2011-08-31 14:49:35 | Re: Index usage on OR queries |