Re: Should I add a Index Key in this case ?

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: Karen Goh <karenworld(at)yahoo(dot)com>
Cc: Steve Midgley <science(at)misuse(dot)org>, pgsql-sql(at)lists(dot)postgresql(dot)org
Subject: Re: Should I add a Index Key in this case ?
Date: 2019-10-16 16:05:26
Message-ID: 11B38F25-EED7-478D-9B02-7D1DF67A5862@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> On Oct 16, 2019, at 9:47 AM, Karen Goh <karenworld(at)yahoo(dot)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.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Arni Kromić 2019-10-17 07:31:08 Re: Save Session?
Previous Message Karen Goh 2019-10-16 15:47:12 Re: Should I add a Index Key in this case ?