EXISTS 子查询:SELECT 1 or SELECT * FROM X performant in Postgres?
EXISTS subquery: SELECT 1 or SELECT * FROM X performant in Postgres?
写
是不是比较好(性能、速度等方面)
SELECT * FROM a WHERE (EXISTS (SELECT * FROM b))
或
SELECT * FROM a WHERE (EXISTS (SELECT 1 FROM b))
在 Postgre 中SQL?
p.s。
This question 回答了我关于 MS SQL 服务器的问题,但是 PostgreSQL 呢?
Since the result depends only on whether any rows are returned, and
not on the contents of those rows, the output list of the subquery is
normally unimportant.
写
是不是比较好(性能、速度等方面)SELECT * FROM a WHERE (EXISTS (SELECT * FROM b))
或
SELECT * FROM a WHERE (EXISTS (SELECT 1 FROM b))
在 Postgre 中SQL?
p.s。 This question 回答了我关于 MS SQL 服务器的问题,但是 PostgreSQL 呢?
Since the result depends only on whether any rows are returned, and not on the contents of those rows, the output list of the subquery is normally unimportant.