Please do an "EXPLAIN ANALYZE" on the query.

http://www.h2database.com/html/performance.html#explain_plan

On 2012-07-11 09:32, Bartosz Skorupa wrote:
I have a simple DB with  table defined :

CREATE TABLE "LOGENTRY"(
AUTOID BIGINT default '(NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_10A53561_6D15_428A_820B_7EA1722BCB5D)' not null,
DATE BIGINT not null,
NANOTIME BIGINT not null,
MESSAGE CLOB,
ID BIGINT not null,
LEVEL SMALLINT not null,
CATEGORY INTEGER not null,
REQUESTERCLASS VARCHAR,
REQUESTERMETHOD VARCHAR,
LINENUMBER INTEGER,
THREADID INTEGER not null,
THREADNAME VARCHAR not null,
THREADGROUP VARCHAR not null,
THREADPRIORITY SMALLINT not null,
STACKTRACE CLOB,
FOREIGN KEY (CATEGORY) REFERENCES LOG_CATEGORIES(ID))

CREATE TABLE "LOGGINGDB20120711_081524"."PUBLIC"."LOG_CATEGORIES"(
ID INTEGER PRIMARY KEY not null,
CATEGORY VARCHAR not null)

I run a example query

SELECT logentry.date , logentry.nanotime FROM logentry, log_categories
WHERE logentry.category = log_categories.id
AND logentry.nanotime >= 4351362368770
AND logentry.nanotime <= 4352180803886
ORDER BY 2 ASC NULLS LAST LIMIT 165 OFFSET 0;

This query run about ~1300ms.

The same DB and the same query on Derby run ~3ms, what is wrong with this?

--
You received this message because you are subscribed to the Google Groups "H2 Database" group. To view this discussion on the web visit https://groups.google.com/d/msg/h2-database/-/GPd5Wv0qYtcJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.


--
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to