在第一行之后停止MySQL查询 [英] Stopping MySQL query after the first row

查看:88
本文介绍了在第一行之后停止MySQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一段MySQL代码,通过一个很长的mysql数据库进行搜索.完成多次后,将花费很长的时间,尽管我从代码中唯一需要做的就是检查至少一个条目的存在.找到一行后,是否可以指示mysql代码停止搜索?谢谢.

I have a piece of MySQL code that searches through a quite lengthy mysql database. When done multiple times, it takes a long time, although the only thing I need from the code is to check the existence of at least one entry. Is it possible to instruct the mysql code to stop searching after finding one row? Thanks.

推荐答案

在查询结束时尝试LIMIT 1.

这篇关于在第一行之后停止MySQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆