Reputation: 3206
I have a sql query, which hangs when changing the select statement from * to only one column. Where could it possibly hang? Isn't that supposed to result faster, since I request only 1 column, instead of 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. the columns have indexes.
Regards
Upvotes: 0
Views: 410
Reputation: 43533
On the surface, it appears there should be no difference between the results. Start by comparing the EXPLAIN PLAN output for each query. If the cost is the same, then there's something else beyond the queries themselves that's at issue here. As @tbone states in the comment, it could be something as simple as caching.
Upvotes: 1