473,395 Members | 2,222 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,395 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 15437
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.