Quantcast
Channel: Active questions tagged surrogate-key - Database Administrators Stack Exchange
Browsing all 31 articles
Browse latest View live

Replacing composite key with surrogate

I have the following table that has a couple of million rows in it and is 99% fragmented virtually all of the time. My plan was to insert a IDENTITY field as a surrogate key to replace the current...

View Article



Problem with a surrogate key?

I am working with an application for students management. For the student's table I used a surrogate key (auto increment id). The problem I face with the surrogate key is when the user wants to show...

View Article

Can a surrogate key and a primary key be in the same table?

For example we have:Surrogate key: ABC123Primary key: 1Name: JamesIs this legit in a Data Warehouse table?

View Article

A question regarding the performance of normalization

I am sorry this is such a newb question, but it is one thing I am having a difficult time wrapping my mind around, and after an evening spent reading I finally just decided to ask for some...

View Article

Image may be NSFW.
Clik here to view.

Should I set document version field to be part of a primary key

Should I set document version as a primary key I am working on a document management system, and I have these two tables representing part of the whole tables.On the DocumentVersion table I have set...

View Article


How to get a surrogate key value in order to put a foreign key in and create...

I am trying to create two relationships between three tables, using foreign keys with values of primary keys, which are surrogate keys. But I don't understand how to enter the right value in the...

View Article

Image may be NSFW.
Clik here to view.

Why should I create an ID column when I can use others as key fields?...

Possible Duplicate:Why use an int as a lookup table's primary key?So far, I'm accustomed to creating an ID column for every table and it is practical in a way that it makes me not think about decision...

View Article

Reassigning surrogate keys?

I have a few tables with surrogate keys (SERIAL PRIMARY KEYs unique to each tables). These tables are used by other tables, with references to these keys. My usage of these is quite simple :select *...

View Article


Surrogate key resolution, or what am I missing in the Surrogate v Natural...

I've read a lot from both camps in the surrogate vs. natural key debate. What I am struggling to understand, and what seems to be glossed over, especially in explaining how surrogate keys are more...

View Article


Surrogate vs composite key in hierarchical data structure

I'm currently evaluating a schema for a hierarchical data structure. My main problem is how I should design the schema to prevent inconsistent data (reference of foreign key in another hierarchy). The...

View Article

PostgreSQL surrogate keys: use sequence/bigint or OID?

I'm looking at a need for surrogate keys in tables I'm designing on a PostgreSQL-derived DBMS (Citus). Would OIDs suffice? Is there a downside to using them instead of creating a bigint field and a...

View Article

Surrogate keys as Foreign Keys

I have a question about Surrogate keys, say i have two tables(in sql server): Table A: Student_ID, Name, School, SectionTable B: Book_ID,Student_ID, IssueDate, BookName If Student_ID is a clustered...

View Article

What are the consequences, positive or negative, to having a surrogate...

I recently made a table that looks like the one belowCREATE TABLE example( id SERIAL PRIMARY KEY, subindusty_id INT UNIQUE NOT NULL, name TEXT NOT NULL -- other fields...)I realized that in this table...

View Article


Common term for tenant-based keys [closed]

Assume the following schema:ID  | TENANT | TENANT_CUSTOM_ID346 | 101    | 1 347 | 102    | 1 348 | 101    | 2 349 | 101    | 3 350 | 101    | 4 351 | 102    | 2 352 | 103    | 1What is another name (or...

View Article

Image may be NSFW.
Clik here to view.

Identity versus Composite values for Primary Keys in Many-To-Many Tables...

I am in the middle of an interesting "Data Architecture" discussion at a place I am contracting & need some input.As a habit, I always create a Surrogate Key as the Primary Key in my tables - be...

View Article


Surrogate key vs Natural key

I have a table called devices. Most of the devices that will get stored in this table can be uniquely identified by their serial number and part number. But there are some device types that do not have...

View Article

What normal form does a surrogate key violate?

I have following question:"What normal form does a surrogate key violate?"My thought was the 3rd normal form, but I'm not quite sure it's just an assumption i am making. Could someone explain that to me?

View Article


Should every table have a single-field surrogate/artificial primary key?

I understand one benefit of surrogate/artificial keys in general - they do not change and that can be very convenient. This is true whether they are single or multiple field - as long as they are...

View Article

Foreign keys - link using surrogate or natural key?

Is there a best practice for whether a foreign key between tables should link to a natural key or a surrogate key? The only discussion I've really found (unless my google-fu is lacking) is Jack...

View Article

Image may be NSFW.
Clik here to view.

Do natural keys provide higher or lower performance in SQL Server than...

I'm a fan of surrogate keys. There is a risk my findings are confirmation biased. Many questions I've seen both here and at http://stackoverflow.com use natural keys instead of surrogate keys based on...

View Article
Browsing all 31 articles
Browse latest View live




Latest Images