-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
database/gdb: add exist feature #3657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
) | ||
} | ||
} | ||
return false, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
直接用Count
就可以实现Exist
,为什么需要单独加一个方法呢?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
纯粹只是为了开发时方便
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不过我感觉直接使用COUNT,效率不够高,待我优化一下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
查询时生成的sql 为SELECT 1 FROM
user_1719281175072039000WHERE
id >= 1 LIMIT 1
在单纯需要判断是否存在符合条件的数据,但对数量不敏感时,有limit效率高一些
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cyjaysong 感谢参与贡献,不过这个Exist
确实与Count
有一些冗余,所以无法合并进入主分支。
@gqcn 这个合了吧,业务开发场景挺常用的,虽然Count 能够实现,但是效率肯定没这个方式高啊 |
@gqcn That’s it. It’s quite common in business development scenarios. Although Count can be implemented, the efficiency is definitely not as high as this method. |
@cyjaysong 请重新提交一下pr,我们再重新走一下review流程,该pr已经无法打开了。 |
@cyjaysong Please resubmit the PR. We will go through the review process again. The PR cannot be opened. |
database/gdb: add exist feature