Wednesday, May 23, 2007

SELECT *

i found this haha img on mysql webinars.


this post not about sql error on img but about post subject.
it's ok when your table is

CREATE TABLE `your_table` (
`id` tinyint(3) unsigned NOT NULL auto_increment,
`smthing` tinyint(3) NOT NULL unsigned,
PRIMARY KEY (`id`)
) ENGINE=MyISAM

only two columns and you can use SELECT * and even you can put subj in 10 places, ok? after month, you alter table, add text field. usually, you not remember all places with this code, so in 10 places it overload resource usage with useless traffic between MySQL and application, isn't it? it mean that is always better to do SELECT `id`, `smthing` FROM... - only needed fields.
so, forget to select all!

No comments:

Post a Comment