Re: (partial?) indexes, LIKE and NULL

From: "PC Drew" <drewpc(at)ibsncentral(dot)com>
To: "Marinos J(dot) Yannikos" <mjy(at)geizhals(dot)at>, <pgsql-performance(at)postgresql(dot)org>
Subject: Re: (partial?) indexes, LIKE and NULL
Date: 2004-01-27 19:51:56
Message-ID: 82CEDAA6A559DB48A373FC3090F2560F35668F@mail.ibsncentral.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

My understanding is that having NULL values in an index breaks it completely. Meaning it won't be used in any query planning. Maybe I'm wrong though...

-----Original Message-----
From: Marinos J. Yannikos [mailto:mjy(at)geizhals(dot)at]
Sent: Tue 1/27/2004 12:26 PM
To: pgsql-performance(at)postgresql(dot)org
Cc:
Subject: [PERFORM] (partial?) indexes, LIKE and NULL

Hi,

with the following table:

Table "public.foo"
Column | Type | Modifiers
--------+------+-----------
t | text |
Indexes:
"a" btree (t)

Shouldn't queries that use
... where t like '%something%'

benefit from "a" when t is NULL in almost all cases, since the query
planner could use "a" to access the few non-NULL rows quickly? It
doesn't seem to work right now.

(I assume that it would make no difference if the index "a" was partial,
excluding NULLs)

Regards,
-mjy

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Berkus 2004-01-27 20:07:33 Re: On the performance of views
Previous Message Bill Moran 2004-01-27 19:39:21 Re: On the performance of views