-----Original Message-----
From: "Glauber Andrade" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]