Reputation: 1228
I'm new to MySQL and want to know that if I have a table with 25 column and the first one of it is the "id". Would the computer render every time through the whole table to search the particular "id".
Upvotes: 0
Views: 58
Reputation: 369
It may depend on the query and also the STORAGE Engine you choose to use.
like MyIsam or InnoDb
example
CREATE TABLE tablename (
id INT UNSIGNED PRIMARY KEY
)ENGINE=MyIsam;
CREATE TABLE tablename (
id INT UNSIGNED PRIMARY KEY
)ENGINE=InnoDB;
there do exist difference in way tables are stored ,dependiing on storage engine , which certainly will reflect in the criteria mysql server (mysqld) performs search to cater your needs .
Upvotes: 0
Reputation: 287
if you construct the query like SELECT * FROM $table_name WHERE table_id=$id;
then it will not render all table.
And as @dku.rajkumar says in the comment, it depends on what you want to fetch and your query structure.
Upvotes: 1