poor Hibernate select performance comparing to running directly - how debug?

前端 未结 2 2134
借酒劲吻你
借酒劲吻你 2020-12-20 16:42

It\'s driving me crazy. Making hibernate simple select is so slow, comparing to running that query directly via Navicat. What is more intereting. Running this query with loc

2条回答
  •  误落风尘
    2020-12-20 17:14

    Thank you all for help. After long time of struggling with that issue, finally kaliatech answer helped me to debug the problem.

    First of all, I've made a terrible mistake in my quesion. I wrote that:

    Running this query with local database is really fast, but using it remotely is really poor.

    As it is not completly true. The query which I did in Hibernate looks like the one up:

    select s.* from sales_unit s left join sales_unit_relation r on (s.sales_unit_id = r.sales_unit_child_id) where r.sales_unit_child_id is null
    

    But the actual query which I did with SQL PLus or Navicat for example was:

    select * from sales_unit s left join sales_unit_relation r on (s.sales_unit_id = r.sales_unit_child_id) where r.sales_unit_child_id is null
    

    Please notice that first query select starts: select s.* ... and second one is select * .... And that was the reason of such poor performance. Now both queries are completed in no time. The question is, what's the difference: performance issue: difference between select s.* vs select *

提交回复
热议问题