Hi,

I can't reproduce the problem, could you post a reproducible test case
please? My test case is:

drop all objects;
CREATE TABLE WS(VAL VARCHAR) as select cast(x*0.8 as int) from
system_range(1, 1000000);
create index idx_ws_val on ws(val);
select top 100 * from ws;
SELECT COUNT(VAL), COUNT(DISTINCT VAL) FROM WS;
CREATE TABLE WS2(VAL VARCHAR) AS SELECT DISTINCT(VAL) FROM WS;

(the query "SELECT COUNT(VAL), COUNT(DISTINCT VAL) FROM WS" actually
ran out of memory because the values are kept fully in memory, which
isn't nice, but I don't plan to fix that currently)

It worked with and without the index. I agree the last statement is a
bit slow (45 seconds), but I don't plan to analyze it currently (it
doesn't look like a very serious problem to me). If you want, please
go ahead. I guess it has to do with a temporary result set. This here
is much faster:

drop all objects;
CREATE TABLE WS(VAL VARCHAR) as select cast(x*0.8 as int) from
system_range(1, 1000000);
CREATE TABLE WS2(VAL VARCHAR);
insert into ws2 SELECT DISTINCT(VAL) FROM WS;

Regards,
Thomas

-- 
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