PK Index - Removal

Started by Patrick Bover 9 years ago5 messagesgeneral
Jump to latest
#1Patrick B
patrickbakerbr@gmail.com

Hi guys,

I got the following index:

CREATE INDEX "ix_mo_pk" ON "mo" USING "btree" ((("id")::"text"))

The "ID" is my primary key:

"mo_pkey" PRIMARY KEY, "btree" ("id")

The ix_mo_pk index is not being used... But as it has the "ID" on it, I
wanted to ask before dropping it.

Can you guys explain me if the ix_mo_pk is safe to delete and why?

The mo_pkey index is being used.

I'm using Postgres 9.2

Thanks
Patrick

#2Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Patrick B (#1)
Re: PK Index - Removal

On 08/10/2016 08:30 PM, Patrick B wrote:

Hi guys,

I got the following index:

CREATE INDEX "ix_mo_pk" ON "mo" USING "btree" ((("id")::"text"))

The "ID" is my primary key:

"mo_pkey" PRIMARY KEY, "btree" ("id")

The ix_mo_pk index is not being used... But as it has the "ID" on it, I
wanted to ask before dropping it.

Can you guys explain me if the ix_mo_pk is safe to delete and why?

To be sure it would be nice to see from psql:

\d+ mo

The mo_pkey index is being used.

I'm using Postgres 9.2

Thanks
Patrick

--
Adrian Klaver
adrian.klaver@aklaver.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Andreas Kretschmer
andreas@a-kretschmer.de
In reply to: Patrick B (#1)
Re: PK Index - Removal

Yes, you can drop the unused index.

On 11 August 2016 05:30:15 CEST, Patrick B <patrickbakerbr@gmail.com> wrote:

Hi guys,

I got the following index:

CREATE INDEX "ix_mo_pk" ON "mo" USING "btree" ((("id")::"text"))

The "ID" is my primary key:

"mo_pkey" PRIMARY KEY, "btree" ("id")

The ix_mo_pk index is not being used... But as it has the "ID" on it, I
wanted to ask before dropping it.

Can you guys explain me if the ix_mo_pk is safe to delete and why?

The mo_pkey index is being used.

I'm using Postgres 9.2

Thanks
Patrick

--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.

#4Venkata B Nagothi
nag1010@gmail.com
In reply to: Patrick B (#1)
Re: PK Index - Removal

On Thu, Aug 11, 2016 at 1:30 PM, Patrick B <patrickbakerbr@gmail.com> wrote:

Hi guys,

I got the following index:

CREATE INDEX "ix_mo_pk" ON "mo" USING "btree" ((("id")::"text"))

The "ID" is my primary key:

"mo_pkey" PRIMARY KEY, "btree" ("id")

The ix_mo_pk index is not being used... But as it has the "ID" on it, I
wanted to ask before dropping it.

Can you guys explain me if the ix_mo_pk is safe to delete and why?

The mo_pkey index is being used.

Yes, you can drop the unused Indexes provided they are not the ones created
by primary key or unique key constraints. By your explanation, it seems
that the index "ix_mo_pk" is an user defined index (created by you), so, it
can be dropped if not used.

Regards,
Venkata B N

Fujitsu Australia

#5Patrick B
patrickbakerbr@gmail.com
In reply to: Venkata B Nagothi (#4)
Re: PK Index - Removal

Cool... Thanks guys!

Index removed.

Patrick