db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Pendleton <bpendleton.de...@gmail.com>
Subject Re: slow query? (from a practical newbie)
Date Wed, 08 Jan 2014 00:59:00 GMT
On 1/7/2014 12:52 PM, degenaro wrote:
> Bryan Pendleton-3 wrote
>> Are the queries that we're discussing here running slowly for you?
>
> Yes, very slow.  With about 50,000 rows the query takes about 30 seconds
> give or take.  But if I remove the where clause, the time is sub second.

Wow, that's crazy! That query should take about .03 seconds, not 30!

What happens if you change the query from

	SELECT * FROM ...
to
	SELECT COUNT(*) FROM ...

That is, select the count rather than the actual rows.

Also, instead of

	SELECT * FROM ...
try
	SELECT ID FROM ...

In both cases, I'm wondering if somehow the problem is in the output
phase, like there's a huge amount of output because there's a BLOB
column in your table or something like that, or the client side is
just taking an eternity to process the output.

Because the query plan indicates that you're just reading 57 pages,
and 50K rows, and that's nothing that should even cause Derby to
break a sweat.

thanks,

bryan



Mime
View raw message