jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Seidel. Robert" <Robert.Sei...@aeb.de>
Subject Slow sql query performance (against xpath)
Date Wed, 18 Aug 2010 13:02:14 GMT
Hi,

this code:

            QueryManager qm = session1.getWorkspace().getQueryManager();
            Query q = null;
            String queryString = "//*[@a_filename = '" + "1761.pdf" + "']";
            q = qm.createQuery(queryString, Query.XPATH);
            System.out.println((new GregorianCalendar()).getTimeInMillis()+" XPath Query created...");
            QueryResult result = q.execute();
            System.out.println((new GregorianCalendar()).getTimeInMillis()+" XPath Query performed...");

Produced:

1282136144493 XPath Query created...
1282136144509 XPath Query performed...

= 16 milliseconds

The same sql code:

            QueryManager qm = session1.getWorkspace().getQueryManager();
            Query q = null;
            String queryString =
                "select * from [nt:base] where a_filename = '1761.pdf'";
            q = qm.createQuery(queryString, Query.JCR_SQL2);
            System.out.println((new GregorianCalendar()).getTimeInMillis()+" Query created...");
            QueryResult result = q.execute();
            System.out.println((new GregorianCalendar()).getTimeInMillis()+" Query performed...");

Produced:

1282136145509 Query created...
1282136256319 Query performed...

= 110810 milliseconds

What can I do, to get nearly the same performance with sql as I get with XPath?

Kindly regards,

Robert Seidel

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message