Questions tagged [primary-key-design]
83 questions
0
votes
1 answer
Why does a database have a weird alphanumeric key
I am trying to connect data in two databases, both created automatically by a different UI application. In one, all the keys are in this format "D8FC23D7-97D6-42F5-A52F-1CE93087B3A4".
Is there any reason this would be done? I also saw keys that…

blindguy
- 946
- 10
- 16
0
votes
1 answer
What type of primary key we need to use for specific length of bits in Cassandra?
I want to know in which situations which type of primary key I need to use.
Situations:
1. If I need 64 bit key than is bigint is the best for it? If I will chose text type will performance will be the same if I will put keys which is not more then…

Oleksandr
- 3,574
- 8
- 41
- 78
0
votes
2 answers
Adding a new primary key to existing table
I have table with following details
Table name EMPLOYEE and columns
EMPID (PK smallint not null)
EMPNAME (varchar 256 not null)
ORG (FK smallint not null)
FUNCTION (FK smallint not null)
EFF_DATE (datetime null)
AUDIT_ID (varchar null)
Now I have…

GustyWind
- 3,026
- 3
- 41
- 50
0
votes
0 answers
User ID Primary Key Length
I am designing a database with multiple tables like users, content, etc. I want to allot id to each row in the tables.
So what are the criteria to generate an unique id for each row in each table. And should I make the id in auto increment mode?

Aditya Borde
- 1,227
- 2
- 12
- 31
0
votes
1 answer
Restarting Primary Key
Here is my situation:
I have a table that gets truncated once a week and new values are placed in it.
What I want to do:
I want to add a primary key that starts at 1 and increases by 1 for each row in the table that gets inserted. When the table…

Chicken Sandwich No Pickles
- 2,953
- 8
- 45
- 92
0
votes
1 answer
How can a field of number data type be formatted to allow its inputted value to retain a nonzero number one digit to the right of a decimal point?
I have tried setting up a primary key with either General Number or Fixed format, and I set the decimal point to 1 digit... as soon as I finish typing into the table an amount (e.g. 101.1), as soon as I click the pointer on another field, the value…
0
votes
2 answers
MySQL moving primary key from varchar to int
I have three tables in MySQL (innodb) (X, Y and Z). X is a table with more than 10 million rows, and has primary key of Y as foreign key. Similarly, Z is table with more than 30 million rows and has primary key of Y as foreign key.
Now the problem…

G.D. Singh
- 173
- 1
- 18
0
votes
1 answer
Use of natural key in date dimension
I am trying really hard to understand the concept of having natural keys in date Dimension table.
I have always seen a random surrogate keys being created in the dimension tables. But I have recently read that using a natural key in date dimension…

imba22
- 651
- 1
- 13
- 25
0
votes
1 answer
Table Indexing consideration for SaaS Project
Would be good to hear you guys out about how best to consider the indexing strategy, because the data in these tables may grow tremendously in the time to come. Decided to proceed by storing multi-tenant data in a single table approach. For an…

Yamsuh
- 3
- 1
0
votes
1 answer
How to implement a scalable, unordered collection in DynamoDB?
I am looking into implementing a scalable unordered collection of objects on top of Amazon DynamoDB. So far the following options have been considered:
Use DynamoDB document data types (map, list) and use document path to access stand-alone items.…

Andrei
- 1
- 2
0
votes
2 answers
SQL Server assign negative PK values by default
When writing my thesis, I was writing a part about SQL data types and how to choose them wisely when designing a database structure.
I read somewhere that as a best practice you should not assign negative values to PK. this lead to the following…

David Defossez
- 11
- 2
0
votes
1 answer
reverse domain name row key, automatic splitting, and load balancing
I'm designing an HBase schema with a row key that starts with the domain name reversed. E.g., com.example.www. Although there are many more domains that end in .com than say .org or .edu, I assume that I don't have to manage splitting myself, and…

Mark Rajcok
- 362,217
- 114
- 495
- 492
0
votes
2 answers
Primary Key as domain username AND userID?
I have read here that it is probably better to use an AI integer to denote users as opposed to an assigned domain (string) username. I can accept that, however, when I am including in the 'users' table the auto generated userid and the unique…

ksdst1
- 35
- 1
- 7
0
votes
1 answer
Getting in a muddle with numeric primary keys
I hope someone can help. I'm trying to set up something along the below but am getting in a bit of a muddle. From what I understand, deriving a numeric ID variable (eg auto-incremented) for the primary key is more efficient that using a composite…

Bendy
- 3,506
- 6
- 40
- 71
0
votes
0 answers
Auto-increment ID column with natural primary key
I am currently supplementing my table's natural primary key with a unique, auto-increment ID column.
This makes it easier to compare, update, and delete records from code (simpler WHERE clauses).
How does this compare to using ID as the primary key…

Dan Bechard
- 5,104
- 3
- 34
- 51