cocoa调用mysql_最好在mysql中调用很多字段时使用*?

参见英文答案 > 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 >

我更喜欢列出所有项目,因为在那个页面上,如果我需要来自数据库的东西,但是如果它会更快,那么我很容易看到我可以使用的内容

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值