Received: from candle.pha.pa.us (root@s5-03.ppp.op.net [209.152.195.67]) by hub.org (8.9.3/8.9.3) with ESMTP id UAA81696 for ; Wed, 9 Jun 1999 20:53:37 -0400 (EDT) (envelope-from maillist@candle.pha.pa.us) Received: (from maillist@localhost) by candle.pha.pa.us (8.9.0/8.9.0) id UAA14533; Wed, 9 Jun 1999 20:51:04 -0400 (EDT) From: Bruce Momjian Message-Id: <199906100051.UAA14533@candle.pha.pa.us> Subject: Re: [HACKERS] Postgres 6.5 beta2 and beta3 problem In-Reply-To: <29420.928948234@sss.pgh.pa.us> from Tom Lane at "Jun 9, 1999 01:10:34 pm" To: Tom Lane Date: Wed, 9 Jun 1999 20:51:04 -0400 (EDT) CC: Daniel Kalchev , pgsql-hackers@postgreSQL.org X-Mailer: ELM [version 2.4ME+ PL56 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit > LIKE doesn't know anything about indexes, nor vice versa. What the > index-scan machinery *does* know about is <, <=, etc. If you have > WHERE clauses like "x >= 33" and "x <= 54" then an index scan knows > to only scan the part of the index from 33 to 54. So you never even > visit a large fraction of the table. This is why an index scan can > be faster than a sequential scan even though the per-tuple overhead > of consulting the index is larger. > You know, everyone beats me up for that LIKE indexing hack, but every month that goes by where someone does not come up with a better solution makes me feel a little better about the criticism. -- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026