473,322 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

(primary key == index) ?

when I create a table, I always make the first column my unique-id, and make
this primary key auto-increment.
Does this mean that the table will be indexed by mysql on this key - or do I
need to explicitly do this too?

e.g.

create table note
(
note_id INTEGER(9) AUTO_INCREMENT PRIMARY KEY,
mytext varchar(255)
);

So do I need to add something to get mysql indexing on the primary key?

many thanks,
JJ
Jul 19 '05 #1
4 15434
erehwon wrote:
when I create a table, I always make the first column my unique-id, and make
this primary key auto-increment.
Does this mean that the table will be indexed by mysql on this key - or do I
need to explicitly do this too?


interesting question. I wanted to know the answer to this too, so I
looked it up in the documentation at www.mysql.com. the answer is "yes"
- the table is indexed. this can be verified by running 'SHOW INDEX FROM
<table_name>' using the mysql client.

/dave

Jul 19 '05 #2
erehwon wrote:
when I create a table, I always make the first column my unique-id, and make
this primary key auto-increment.
Does this mean that the table will be indexed by mysql on this key - or do I
need to explicitly do this too?


interesting question. I wanted to know the answer to this too, so I
looked it up in the documentation at www.mysql.com. the answer is "yes"
- the table is indexed. this can be verified by running 'SHOW INDEX FROM
<table_name>' using the mysql client.

/dave

Jul 19 '05 #3
great :o) & thanks!

JJ

"Dave Roe" <da******@email.com> wrote in message
news:DH*******************@newsread2.news.pas.eart hlink.net...
erehwon wrote:
when I create a table, I always make the first column my unique-id, and make this primary key auto-increment.
Does this mean that the table will be indexed by mysql on this key - or do I need to explicitly do this too?


interesting question. I wanted to know the answer to this too, so I
looked it up in the documentation at www.mysql.com. the answer is "yes"
- the table is indexed. this can be verified by running 'SHOW INDEX FROM
<table_name>' using the mysql client.

/dave

Jul 19 '05 #4
great :o) & thanks!

JJ

"Dave Roe" <da******@email.com> wrote in message
news:DH*******************@newsread2.news.pas.eart hlink.net...
erehwon wrote:
when I create a table, I always make the first column my unique-id, and make this primary key auto-increment.
Does this mean that the table will be indexed by mysql on this key - or do I need to explicitly do this too?


interesting question. I wanted to know the answer to this too, so I
looked it up in the documentation at www.mysql.com. the answer is "yes"
- the table is indexed. this can be verified by running 'SHOW INDEX FROM
<table_name>' using the mysql client.

/dave

Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Tuhin Kumar | last post by:
Hi, Oracle give the error ORA-01418 when I try to do the following; Create unique index t1_pk on TABLE1(EntryId DESC) ; If the I try to add primary key Contraint using the above index t1_pk...
17
by: Philip Yale | last post by:
I'm probably going to get shot down with thousands of reasons for this, but I've never really heard or read a convincing explanation, so here goes ... Clustered indexes are more efficient at...
4
by: serge | last post by:
I ran into a table that is used a lot. Well less than 100,000 records. Maybe not a lot of records but i believe this table is used often. The table has 26 fields, 9 indexes but no Primary Key at...
6
by: Bob Stearns | last post by:
I was under the impression that the primary key had to be a unique index. Since I usually create my primary indices before my primary keys, in order to get the indices in the same schema as their...
4
by: deko | last post by:
I have a Make Table query that creates a fairly large table. The Make Table query populates the new table with one AutoNumber field (which is taken form another unrelated table as part of the...
8
by: Paul Hunter | last post by:
I am new to databases and thus to Access. I have a situation where I am trying to figure out how to key some tables I am working with. Consider that I have a database of my own records which are...
9
by: sonal | last post by:
Hi all, I hv started with python just recently... and have been assigned to make an utility which would be used for data validations... In short we take up various comma separated data files for...
3
by: vj_dba | last post by:
Hi Group, I have a Primary key in my table. It's clear Primary key wont allow duplicates, this primary key creates one index for retrival. Suppose if my table is having a Unique index also....
1
by: mark_aok | last post by:
Hi all, I have a situation where I need to determine a specific table's primary key, and then output it. I have tried the Database Object, and the Record Object, but I've had no luck. ...
4
by: codefragment | last post by:
Hi I thought that given a table with an index, primary key and clustered index any non clustered index look ups would go via the clustered index and the primary key is irrelevant? (sql server...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.