X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 52750D1B537 for ; Wed, 29 Oct 2003 15:17:59 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 38400-04 for ; Wed, 29 Oct 2003 11:17:32 -0400 (AST) Received: from mail.hive.nj2.inquent.com (mc.carriermail.com [205.178.180.9]) by svr1.postgresql.org (Postfix) with SMTP id E5FDBD1B508 for ; Wed, 29 Oct 2003 11:17:22 -0400 (AST) Received: (qmail 20569 invoked from network); 29 Oct 2003 15:16:31 -0000 Received: from unknown (HELO ?10.0.2.5?) (216.208.117.7) by 205.178.180.9 with SMTP; 29 Oct 2003 15:16:31 -0000 Subject: Re: redundent index? From: Rod Taylor To: Robert Treat Cc: Postgresql Performance In-Reply-To: <1067436236.2069.28785.camel@camel> References: <1067436236.2069.28785.camel@camel> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-JrIgf+aZ/bwKPCl6LkvD" Message-Id: <1067440627.5789.2.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Wed, 29 Oct 2003 10:17:24 -0500 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/725 X-Sequence-Number: 4473 --=-JrIgf+aZ/bwKPCl6LkvD Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Wed, 2003-10-29 at 09:03, Robert Treat wrote: > I just noticed on one of my tables I have the following two indexes: >=20 > Indexes: entity_watch_map_pkey primary key btree (entity_id, watch_id), > ewm_entity_id btree (entity_id), >=20 >=20 > I can't think of why the second index is there, as ISTM there is no > instance where the first index wouldn't be used in place of the second The cost in evaluating the first index will be a little higher (more data to pull off disk due to second item), so there may be a few borderline cases that could switch to a sequential scan rather than an index scan. --=-JrIgf+aZ/bwKPCl6LkvD Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQA/n9nz6DETLow6vwwRAtbvAKCF3HGfA2T7lz3og7ntfapVyRAyVgCfeS5t unNgh8ZmMa1gm7W9dPJwDWk= =V03b -----END PGP SIGNATURE----- --=-JrIgf+aZ/bwKPCl6LkvD--