agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Rob Sargent <robjsargent@gmail.com>
To: Karen Goh <karenworld@yahoo.com>
Cc: Steve Midgley <science@misuse.org>
Cc: pgsql-sql@lists.postgresql.org
Subject: Re: Should I add a Index Key in this case ?
Date: Wed, 16 Oct 2019 10:05:26 -0600
Message-ID: <11B38F25-EED7-478D-9B02-7D1DF67A5862@gmail.com> (raw)
In-Reply-To: <1747806136.1620685.1571240832461@mail.yahoo.com>
References: <1846839195.1533405.1571225796919@mail.yahoo.com>
	<CAJexoSJ-08_uaDwm+5GNieYqEJ-QayMwQGzR1u1-2CEcQ+fsHw@mail.gmail.com>
	<1747806136.1620685.1571240832461@mail.yahoo.com>



> On Oct 16, 2019, at 9:47 AM, Karen Goh <karenworld@yahoo.com> wrote:
> 
> Hi Steve,
> 
> My question is should I use index on the Seat_Viewing_id ?
> 
> I have no experience in using Index hence I asked if it should be made auto-incremental?
> 
> Kindly advise how should I alter my existing table to have index. 
> 
> Tks!
> 
alter table doc here: https://www.postgresql.org/docs/10/sql-altertable.html <https://www.postgresql.org/docs/10/sql-altertable.html;
you will likely need an index on that new column, though it’s not clear to how you wish to fill in the value for existing rows.  Perhaps you should share your current table definition?
I think you may need a seat_viewing table, in which you place the id of the viewed seats.  You would want a unique index on the new table using the existing seat id but you do NOT want the column to be of type serial, just (big?) integer.

view thread (4+ messages)

Message-ID: <11B38F25-EED7-478D-9B02-7D1DF67A5862@gmail.com>
Permalink:  ../11B38F25-EED7-478D-9B02-7D1DF67A5862@gmail.com/
Also on:    postgresql.org/message-id/11B38F25-EED7-478D-9B02-7D1DF67A5862@gmail.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: robjsargent@gmail.com, karenworld@yahoo.com, science@misuse.org, pgsql-sql@lists.postgresql.org
  Subject: Re: Should I add a Index Key in this case ?
  In-Reply-To: <11B38F25-EED7-478D-9B02-7D1DF67A5862@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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