Search Postgresql Archives

Re: Index usage on OR queries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 31, 2011 at 4:49 PM, Andy Colson <andy@xxxxxxxxxxxxxxx> 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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux