pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
turn off auto index for foreign key
5+ messages / 3 participants
[nested] [flat]

* turn off auto index for foreign key
@ 2008-06-10 02:48 Tommy Cheng <csckcac@gmail.com>
  2008-06-10 03:50 ` Re: turn off auto index for foreign key Scott Marlowe <scott.marlowe@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Tommy Cheng @ 2008-06-10 02:48 UTC (permalink / raw)
  To: pgsql-admin

Hi admins,
  I would like to turn off the auto index for child table's foreign key. It
is because i want to read the information_schema for table, column, index,
unique and so on after creating the database. How to turn off the auto
behavior? Or Is there a way to distinguish between auto one and user created
index?
  Thanks
Tommy Cheng

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: turn off auto index for foreign key
  2008-06-10 02:48 turn off auto index for foreign key Tommy Cheng <csckcac@gmail.com>
@ 2008-06-10 03:50 ` Scott Marlowe <scott.marlowe@gmail.com>
  2008-06-10 04:17   ` Re: turn off auto index for foreign key Tommy Cheng <csckcac@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Scott Marlowe @ 2008-06-10 03:50 UTC (permalink / raw)
  To: Tommy Cheng <csckcac@gmail.com>; +Cc: pgsql-admin

On Mon, Jun 9, 2008 at 8:48 PM, Tommy Cheng <csckcac@gmail.com> wrote:
> Hi admins,
>   I would like to turn off the auto index for child table's foreign key. It
> is because i want to read the information_schema for table, column, index,
> unique and so on after creating the database. How to turn off the auto
> behavior? Or Is there a way to distinguish between auto one and user created
> index?

There is no auto index creation for child relationships, only for the
parent (unique index for primary key etc)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: turn off auto index for foreign key
  2008-06-10 02:48 turn off auto index for foreign key Tommy Cheng <csckcac@gmail.com>
  2008-06-10 03:50 ` Re: turn off auto index for foreign key Scott Marlowe <scott.marlowe@gmail.com>
@ 2008-06-10 04:17   ` Tommy Cheng <csckcac@gmail.com>
  2008-06-10 04:58     ` Re: turn off auto index for foreign key Alex Hunsaker <badalex@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Tommy Cheng @ 2008-06-10 04:17 UTC (permalink / raw)
  To: pgsql-admin

you are right. I double checked. So, is there any way to turn off auto index
creation for the parent? (the best is changing postgresql database setting)
I am using postgres (PostgreSQL) 8.1.9 on CentOS 5 x86_64

On Tue, Jun 10, 2008 at 11:50 AM, Scott Marlowe <scott.marlowe@gmail.com>
wrote:

> On Mon, Jun 9, 2008 at 8:48 PM, Tommy Cheng <csckcac@gmail.com> wrote:
> > Hi admins,
> >   I would like to turn off the auto index for child table's foreign key.
> It
> > is because i want to read the information_schema for table, column,
> index,
> > unique and so on after creating the database. How to turn off the auto
> > behavior? Or Is there a way to distinguish between auto one and user
> created
> > index?
>
> There is no auto index creation for child relationships, only for the
> parent (unique index for primary key etc)
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: turn off auto index for foreign key
  2008-06-10 02:48 turn off auto index for foreign key Tommy Cheng <csckcac@gmail.com>
  2008-06-10 03:50 ` Re: turn off auto index for foreign key Scott Marlowe <scott.marlowe@gmail.com>
  2008-06-10 04:17   ` Re: turn off auto index for foreign key Tommy Cheng <csckcac@gmail.com>
@ 2008-06-10 04:58     ` Alex Hunsaker <badalex@gmail.com>
  2008-06-10 05:16       ` Re: turn off auto index for foreign key Tommy Cheng <csckcac@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Alex Hunsaker @ 2008-06-10 04:58 UTC (permalink / raw)
  To: Tommy Cheng <csckcac@gmail.com>; +Cc: pgsql-admin

On Mon, Jun 9, 2008 at 10:17 PM, Tommy Cheng <csckcac@gmail.com> wrote:
> you are right. I double checked. So, is there any way to turn off auto index
> creation for the parent? (the best is changing postgresql database setting)
> I am using postgres (PostgreSQL) 8.1.9 on CentOS 5 x86_64
>

Again, there is no auto index creation for foriegn keys.  However if
you declared the column unique or its the pkey (ala unique) (As Scott
said) then there will  an index.

No you cant turn it off because its how postgres enforces uniqueness
see http://www.postgresql.org/docs/8.1/interactive/index-unique-checks.html
for more

My guess, use the name of the index to try to distinguish.  Auto
generated ones will always be in the form:
pkey: <table_name>_pkey(num)
unique: <table_name>_<column_name>_key(num)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: turn off auto index for foreign key
  2008-06-10 02:48 turn off auto index for foreign key Tommy Cheng <csckcac@gmail.com>
  2008-06-10 03:50 ` Re: turn off auto index for foreign key Scott Marlowe <scott.marlowe@gmail.com>
  2008-06-10 04:17   ` Re: turn off auto index for foreign key Tommy Cheng <csckcac@gmail.com>
  2008-06-10 04:58     ` Re: turn off auto index for foreign key Alex Hunsaker <badalex@gmail.com>
@ 2008-06-10 05:16       ` Tommy Cheng <csckcac@gmail.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Tommy Cheng @ 2008-06-10 05:16 UTC (permalink / raw)
  To: pgsql-admin

um...Your soln is possible. But if the user created an unique index using
constraint name <table_name>_<column_name>_key5, it will not be able to
distinguish it from other auto index.

On Tue, Jun 10, 2008 at 12:58 PM, Alex Hunsaker <badalex@gmail.com> wrote:

> On Mon, Jun 9, 2008 at 10:17 PM, Tommy Cheng <csckcac@gmail.com> wrote:
> > you are right. I double checked. So, is there any way to turn off auto
> index
> > creation for the parent? (the best is changing postgresql database
> setting)
> > I am using postgres (PostgreSQL) 8.1.9 on CentOS 5 x86_64
> >
>
> Again, there is no auto index creation for foriegn keys.  However if
> you declared the column unique or its the pkey (ala unique) (As Scott
> said) then there will  an index.
>
> No you cant turn it off because its how postgres enforces uniqueness
> see
> http://www.postgresql.org/docs/8.1/interactive/index-unique-checks.html
> for more
>
> My guess, use the name of the index to try to distinguish.  Auto
> generated ones will always be in the form:
> pkey: <table_name>_pkey(num)
> unique: <table_name>_<column_name>_key(num)
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2008-06-10 05:16 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-06-10 02:48 turn off auto index for foreign key Tommy Cheng <csckcac@gmail.com>
2008-06-10 03:50 ` Scott Marlowe <scott.marlowe@gmail.com>
2008-06-10 04:17   ` Tommy Cheng <csckcac@gmail.com>
2008-06-10 04:58     ` Alex Hunsaker <badalex@gmail.com>
2008-06-10 05:16       ` Tommy Cheng <csckcac@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox