欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

sql -- 如何解决 select in 中的项过多的问题

程序员文章站 2022-06-30 12:18:26
如果 select in 中包含的项过多,会严重影响程序的性能,解决方法为:注意 'admin,test' 为一个完整的字符串,而不是 'admin','test'select account,id,password from test t1 join( SELECT unnest(string_to_array('admin,test', ',')) as name) t2on t1.account = t2.name再举一个更复杂些的例子SELECTt1.ID,t2.r...

如果 select in 中包含的项过多,会严重影响程序的性能,解决方法为:

注意 'admin,test' 为一个完整的字符串,而不是 'admin','test'

select account,id,password from test t1  
join
( SELECT unnest(string_to_array('admin,test', ','))  as  name)  t2
on  t1.account = t2

本文地址:https://blog.csdn.net/weixin_38645718/article/details/107674597