0 Replies Latest reply on May 24, 2005 3:56 AM by Grzegorz Knapczyk

    low performance in Query (how to EXPLAIN SELECT ... in hiber

    Grzegorz Knapczyk Newbie

      I have written an entity bean wrapper to the existing TABLE in PostgreSQL.

      create table pr_base{
       id varchar(100) no null, -- PK
       channel varchar(4),
       airdate date,
       (...)
      }
      
      
      CREATE INDEX idx_airdate_channel
       ON pr_base
       USING btree
       (airdate, channel);
      
      


      I have defined a business method to find all records by channel and airdate.
      public List findByDateChannel(String airdate, String channel){
       return em.createQuery("FROM PrRecord pr WHERE airdate = :airdate and channel = :channel")
       .setParameter("airdate", airdate)
       .setParameter("channel", channel)
       .getResultList();
      }
      

      However the method is very slow, like it wouldn't use idx_airdate_channel?
      Is it possible to force hibernate to explain query, i.e. use "EXPLAIN SELECT ..."?