Oracle SQL - 最小化Select语句时查询挂起

时间:2012-02-24 19:29:33

标签: sql performance oracle

我有一个SQL查询,在将select语句从*更改为只有一列时会挂起。哪里可能挂?这不应该更快,因为我只请求1列,而不是50?

select * from table1 t1, table2 t2 where t1.id1 = t2.id2 and t2.columnX = :x

select t1.column1 from table1 t1, table2 t2 where t1.id1 = t2.id2 and t2.columnX = :x

P.S。列有索引。

此致

1 个答案:

答案 0 :(得分:1)

表面上看,结果之间应该没有区别。首先比较每个查询的EXPLAIN PLAN输出。如果成本相同,那么除了查询本身之外还有其他问题。正如@tbone在评论中指出的那样,它可能就像缓存一样简单。

相关问题