In relational database design, a primary key can uniquely identify each row in a table. A primary key comprises a single column or a set of columns.

learn more… | top users | synonyms

0
votes
1answer
49 views

How to arrange rows selected in MYSQL query?

I'm fetching data from a table "TABLE_A", it's having Primary Key as "PK_ONE" (which is unsigned INT) . I'm fetching data from "TABLE_A" with where clause on PK_ONE ; Ex: SELECT PK_ONE from TABLE_A ...
0
votes
1answer
252 views

Postgresql table with one integer column, sorted index, with duplicate primary key

I want to have a table in PostgreSQL with these properties: One column with an integer Allow duplicates in this column. Duplicates will be rare. Duplicates have no meaning logically and will be ...
0
votes
1answer
35 views

Modify legacy table schemas that have no primary key

I've been tasked with updating our database (SQL Server 2008) so that every table in it has a proper primary key defined. Due to various reasons over the years we have somehow built up some legacy ...
0
votes
1answer
135 views

Retrieving all PK and FK with pgadmin

I have a big database that I need to extract all primary keys and foreign keys from each table. I have pgAdmin III. Is there a way to do this automatically and not go over each table manually?
0
votes
1answer
323 views

DynamoDB: searching with primary key or range key, which way is faster?

To those familiar with DynamoDB, I'm trying to make a table where items only have 2 entries. For example, . Most of the time I'll be searching the user_id with a facebook_id on hand. Amazon's ...
0
votes
1answer
2k views

How can primary keys in a Netezza table be indexed?

What is the best way to index a Netezza fact table with lots of primary keys. For now, let's suppose we have 10 primary keys. This table is mainly used to store meta data about our database. ...
0
votes
1answer
154 views

Impact of miss-ordered fields in a composite, clustered primary key?

I have tables where the primary key is something like this: -StoreID -BusinessDate Typically, there is one row for every store (~100) for every single day. One row for each store is inserted on a ...
0
votes
0answers
24 views

Converting UUID's from CHAR(32) to BIN(16)

I have a few questions relating to UUID's, but before I go on, let me explain our schema a bit, first, we're on MySQL 5.5 (Percona's version to be exact)... In each applicable table, we use a two ...
0
votes
0answers
17 views

Primary keys optimized for database sync

I am implementing lazy multi-master database synchronization in star shape network using SymmetricDS. I can not estimate the number of nodes, so I can't use simple auto-increment integers. Database ...
0
votes
2answers
69 views

Column suitable for natural key?

I have read many articles now about natural vs surrogate primary keys, and came to the conclusion there is no single best practice. I have a table that will have around 2000 definite unique values, ...
0
votes
0answers
19 views

Impact of additional int field as primary key

Directly to the point, at one time I have a table like this: create table item( item_id varchar(50), constraint pk_item1 primary key (item_id) } However from my discussion one day, there is ...
0
votes
0answers
35 views

Overcoming the HDD IOPS limits on a billion row table? Is getting SSD the only solution?

I have a table with this structure: CREATE TABLE `requests` ( `userid` int(11) NOT NULL, `messageid` int(11) NOT NULL, `queueid` int(11) NOT NULL AUTO_INCREMENT, `problem_id` int(3) NOT NULL, ...
0
votes
1answer
71 views

primary key: username+current time or serial

I need to choose a primary key, but I'm not sure what the best option would be. Currently I'm in a scenario where a user has machines (workers) calculating hashes. For each user I track the current ...
0
votes
0answers
40 views

How to retrieve pkey value in mysql/python on duplicate key update

I'm currently using _mysql library in python. it uses pkey(int, auto increment) value that's created when inserting data using function conn.insert_id() This is how the query is made. INSERT INTO ...
0
votes
0answers
145 views

is it good to use combined primary key for MySQL InnoDB clustered index?

I'm trying to build a aggregated reader website of multiple forums. Because most queries are likely to be within same time periods for written_time column, I'm thinking about taking advantage of ...
0
votes
0answers
308 views

Postgresql Retrieve / Find Primary Key Serial Autonumber field for Audit logs

I need to find the Primary Key field name in each of a number (approx 70) of tables to create audit logs. All the primary keys are type serial (auto incrementing integer) and all have the name in the ...
-2
votes
1answer
2k views

What are performance benefits when using number type instead of using char/varchar?

From various posts, I have summarized about using number type instead of char/varchar for PK: If you choose char/varchar type for PK and your values are short (just some alpha numberic codes) then it ...