I have two tables.
=====================================
create table company (
co_id int not null auto_increment primary key,
co_name char(80) not null);
create table user (
us_id int not null auto_increment primary key,
us_co_id int not null,
us_name char(80) not null,
index idx_us_co_id us_co_id());
=====================================
stupid question: I want to leverage the index to select users who are associated with the company. Do I have to reference "idx_us_co_id" or "us_co_id" from table 'user' in order to get the benefit of indexing. In short, which is (theoretically) faster because it is using the index???
STATEMENT 1:
select * from user u, company c where u.idx_us_co_id=c.co_id and u.us_id=5;
STATEMENT 2:
select * from user u, company c where u.us_co_id=c.co_id and u.us_id=5;
Do I even need the index in table 'user' in this use context?
Surfinbox.com Business Internet Services - National Dialup, DSL, T-1 and more.
=====================================
create table company (
co_id int not null auto_increment primary key,
co_name char(80) not null);
create table user (
us_id int not null auto_increment primary key,
us_co_id int not null,
us_name char(80) not null,
index idx_us_co_id us_co_id());
=====================================
stupid question: I want to leverage the index to select users who are associated with the company. Do I have to reference "idx_us_co_id" or "us_co_id" from table 'user' in order to get the benefit of indexing. In short, which is (theoretically) faster because it is using the index???
STATEMENT 1:
select * from user u, company c where u.idx_us_co_id=c.co_id and u.us_id=5;
STATEMENT 2:
select * from user u, company c where u.us_co_id=c.co_id and u.us_id=5;
Do I even need the index in table 'user' in this use context?
Surfinbox.com Business Internet Services - National Dialup, DSL, T-1 and more.