sql - IN vs ANY operator in PostgreSQL -


what difference between in , any operator in postgresql?
working mechanism of both seems same. can explain example?

there 2 variants of in , 2 variants of any construct. details:

the in () variant taking set equivalent = any() taking set, demonstrated here:

but second variant of each not equivalent other. second variant of any construct takes array (must actual array type), while second variant of in takes comma-separated list of values. leads different restrictions in passing values , can lead different query plans in special cases:


the any construct far more versatile, can combined various operators, not =. example like:

select 'foo' any('{foo,bar,%oo%}'); 

for big number of values, providing set scales better each:

related:


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -