![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
If I create a table and assign the column type for what will be the primary key the value of "Serial", do I need to explicitly create an index in addition? I was thinking that a Serial, would automatically be a Unique Index wouldn't it? I also set that field to the primary key... does that ensure an index is created? Just a little confused... Also, while I am on the topic, does it do any good to create indexes on a timestamp field? Thanks in advance, Alan ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org |
#3
| |||
| |||
|
|
If I create a table and assign the column type for what will be the primary key the value of "Serial", do I need to explicitly create an index in addition? I was thinking that a Serial, would automatically be a Unique Index wouldn't it? I also set that field to the primary key... does that ensure an index is created? Just a little confused... Also, while I am on the topic, does it do any good to create indexes on a timestamp field? Thanks in advance, Alan ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org |
#4
| |||
| |||
|
|
You can also use a SEQUENCE which is unique and will add a PK constraint to your field. No. A sequence is just a help to generate sequential numbers as default |
|
Not sure about the date thing because with sequence you would already have a PK for that row ? A bit confused too ... If you use a sequence and don't manipulate the resulting numbers you get |
#5
| |||
| |||
|
|
If I create a table and assign the column type for what will be the primary key the value of "Serial", do I need to explicitly create an index in addition? |
|
I was thinking that a Serial, would automatically be a Unique Index wouldn't it? |
#6
| |||
| |||
|
|
You can also use a SEQUENCE which is unique and will add a PK constraint to your field. No. A sequence is just a help to generate sequential numbers as default |
|
Not sure about the date thing because with sequence you would already have a PK for that row ? A bit confused too ... If you use a sequence and don't manipulate the resulting numbers you get |
![]() |
| Thread Tools | |
| Display Modes | |
| |