参见英文答案 > Why is SELECT * considered harmful?????????????????????????????????????16个
我知道通常情况下,构建mysql查询以命名您需要的每个项目总是更好的性能但是例如在个人资料页面上我可能需要除了少数几个项目之外的所有项目.
SELECT user_name,f_name,l_name,country,usa_state,other_state,zip_code,city,gender,birth_date,date_created,date_last_visit,
user_role,photo_url,user_status,friend_count,comment_count,forum_post_count,referral_count,referral_count_total,
setting_public_profile,setting_online,profile_purpose,profile_height,profile_body_type,profile_ethnicity, profile_occupation,profile_marital_status,profile_sex_orientation,profile_home_town,profile_religion,
profile_smoker,profile_drinker,profile_kids,profile_education,profile_income,profile_headline,profile_about_me,
profile_like_to_meet,profile_interest,profile_music,profile_television,profile_books,profile_heroes,profile_here_for,profile_counter FROM users WHERE user_id=1 AND user_role >
因此,如果没有进行大量测试,也许有经验丰富的人可以提出一些建议吗?
这会更糟吗?
SELECT * FROM users WHERE user_id=1 AND user_role >
我更喜欢列出所有项目,因为在那个页面上,如果我需要来自数据库的东西,但是如果它会更快,那么我很容易看到我可以使用的内容