Hello,
I am trying to optimize a query that returns names from a table where the lastName starts with a certain letter.
Currently, I am using the following:
Criteria criteria = HibernateUtil.getSession().createCriteria(Contact.class)
.createAlias("contactInfo", "c")
.add(Expression.ilike("c.lastName", searchLetter + "%"))
.addOrder(Order.asc("c.lastName"));
return criteria.list();
which is working, but is slow. I have an index on the ContactInfo table on lastName column, which helps, but I'm hoping for better...
I am using a PostgreSQL db, for which I am fairly new at. Is there a better way?
Thanks for any Help!
Eric
_________________ Eric Hansen
|