加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

PostgreSQL – “IN”子句中的最大参数数量?

发布时间:2020-12-13 16:53:22 所属栏目:百科 来源:网络整理
导读:这是一个很棘手的问题,谷歌,所以希望有人可以帮助我在这里。在Postgres中,您可以指定一个IN子句,如: SELECT * FROM user WHERE id IN (1000,1001,1002) 有谁知道什么是最大数量的参数,你可以传入IN? 谢谢。 根据位于 here,starting at line 850,的源
这是一个很棘手的问题,谷歌,所以希望有人可以帮助我在这里。在Postgres中,您可以指定一个IN子句,如:
SELECT * FROM user WHERE id IN (1000,1001,1002)

有谁知道什么是最大数量的参数,你可以传入IN?

谢谢。

根据位于 here,starting at line 850,的源代码PostgreSQL没有明确限制参数的数量。

以下是第870行的代码注释:

/*
 * We try to generate a ScalarArrayOpExpr from IN/NOT IN,but this is only
 * possible if the inputs are all scalars (no RowExprs) and there is a
 * suitable array type available.  If not,we fall back to a boolean
 * condition tree with multiple copies of the lefthand expression.
 * Also,any IN-list items that contain Vars are handled as separate
 * boolean conditions,because that gives the planner more scope for
 * optimization on such clauses.
 *
 * First step: transform all the inputs,and detect whether any are
 * RowExprs or contain Vars.
 */

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读