You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Glauber Andrade <gl...@maximasti.com.br> on 2003/12/01 13:45:13 UTC

too slow!

I am using OJB and Mysql (4.0.16) (with mysql-connector-java-3.0.9-stable)
in an swing application and the system is too slow. A simple query whith
2000 registers takes more than 15s to go.
How can I speed it up ?

Thanks,

Criteria crit = new Criteria();
crit.addEqualTo("id_empresa", "" + empresa.getId());
crit.addOrderBy("pagamento", true);
crit.addOrderBy("prestador.nome", true);
Query q = QueryFactory.newQuery(NotaRecibo.class, crit);
Collection c = broker.getCollectionByQuery(q);


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: too slow!

Posted by Oleg Nitz <on...@ukr.net>.
-----Original Message-----
From: "Glauber Andrade" <gl...@maximasti.com.br>
To: <oj...@db.apache.org>
Date: Mon, 1 Dec 2003 09:45:13 -0300
Subject: too slow!
> I am using OJB and Mysql (4.0.16) (with mysql-connector-java-3.0.9-stable)
> in an swing application and the system is too slow. A simple query whith
> 2000 registers takes more than 15s to go.
> How can I speed it up ?
First of all, does plain JDBC query load the same data much faster?
If yes, you could use proxies to avoid immediate loading of related objects.
If no and queries of this kind will run often, you can build database index for the "id_empresa" column, maybe also for "pagamento".

Regards,
 Oleg

> Criteria crit = new Criteria();
> crit.addEqualTo("id_empresa", "" + empresa.getId());
> crit.addOrderBy("pagamento", true);
> crit.addOrderBy("prestador.nome", true);
> Query q = QueryFactory.newQuery(NotaRecibo.class, crit);
> Collection c = broker.getCollectionByQuery(q);



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org