Computing desk | ||
---|---|---|
< August 14 | << Jul | August | Sep >> | August 16 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
I have to design a series of tables for a database. One of the tables will look like this: (those are the fields): [1] numb_id int (11) AUTO_INCREMENT; [2] attribute-1 double; [3] attribute-2 double [3] attribute-3 double.
I make the first field a primary key.
My question is: will I gain in performance speed with the primary key vs. no primary key? My understanding is that there will be no gain in performance. Primary key is an index field, it means that DBMS will create a separate (index) table that will have this key in the first column but it is already in the first column. That column will be ordered but it is already ordered. It will then probably create pointers to each row in the first table to the row where the primary key is but it's not really needed. Once you get the row in the original table you can read this information directly. Is it all correct?
What could be the situation, what kind of structure the table should have to benefit from introduction of primary key in terms of improved performance. What could be the gain?
Thanks, - -- AboutFace 22 ( talk) 01:43, 15 August 2014 (UTC)
Thank you, Tom. I actually do not know the DBMS that is going to be used. I do not design the whole thing, only a conceptual framework so to speak. I do have some (fairly extensive actually but years ago) background in SQL server and dBase IV now defunct but this is not applicable here. Another person does the implementation. He mentioned a few options, MySql is one of them. The actual choice is still up in the air and will be apparently discussed at a later date but this is not something I can influence because I am not familiar with them.
This is also my impression that in order to be effective the primary key must be a clustered index, otherwise any advantage is not there. It sounds like you are saying that the primary key is always a clustered index even if not designed as such. Thanks, -- AboutFace 22 ( talk) 13:40, 15 August 2014 (UTC)
Thank you, StuRat, you are always helpful. Still one of my questions is unanswered: how much will I gain in speed of storage and retrieval with introduction of primary keys. -- AboutFace 22 ( talk) 17:59, 15 August 2014 (UTC)
This restaurant chain has placed card readers on each table so you can pay by credit card there. However, they are wireless. What type of security precautions do they take so the credit card info can't be compromised ? (This is a practical Q, as I eat there myself, and want to know if it is safe to pay that way.) StuRat ( talk) 22:21, 15 August 2014 (UTC)
Computing desk | ||
---|---|---|
< August 14 | << Jul | August | Sep >> | August 16 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
I have to design a series of tables for a database. One of the tables will look like this: (those are the fields): [1] numb_id int (11) AUTO_INCREMENT; [2] attribute-1 double; [3] attribute-2 double [3] attribute-3 double.
I make the first field a primary key.
My question is: will I gain in performance speed with the primary key vs. no primary key? My understanding is that there will be no gain in performance. Primary key is an index field, it means that DBMS will create a separate (index) table that will have this key in the first column but it is already in the first column. That column will be ordered but it is already ordered. It will then probably create pointers to each row in the first table to the row where the primary key is but it's not really needed. Once you get the row in the original table you can read this information directly. Is it all correct?
What could be the situation, what kind of structure the table should have to benefit from introduction of primary key in terms of improved performance. What could be the gain?
Thanks, - -- AboutFace 22 ( talk) 01:43, 15 August 2014 (UTC)
Thank you, Tom. I actually do not know the DBMS that is going to be used. I do not design the whole thing, only a conceptual framework so to speak. I do have some (fairly extensive actually but years ago) background in SQL server and dBase IV now defunct but this is not applicable here. Another person does the implementation. He mentioned a few options, MySql is one of them. The actual choice is still up in the air and will be apparently discussed at a later date but this is not something I can influence because I am not familiar with them.
This is also my impression that in order to be effective the primary key must be a clustered index, otherwise any advantage is not there. It sounds like you are saying that the primary key is always a clustered index even if not designed as such. Thanks, -- AboutFace 22 ( talk) 13:40, 15 August 2014 (UTC)
Thank you, StuRat, you are always helpful. Still one of my questions is unanswered: how much will I gain in speed of storage and retrieval with introduction of primary keys. -- AboutFace 22 ( talk) 17:59, 15 August 2014 (UTC)
This restaurant chain has placed card readers on each table so you can pay by credit card there. However, they are wireless. What type of security precautions do they take so the credit card info can't be compromised ? (This is a practical Q, as I eat there myself, and want to know if it is safe to pay that way.) StuRat ( talk) 22:21, 15 August 2014 (UTC)