[h2] int not 100% continuous

2022-12-18 Thread mche...@gmail.com
hi i have column which is bigint and not int not 100% continuous , so the data is [1,2,36,10,11] , now i want to reinput the data ane make it continuouse, such as [1,2,3,4,5,6]. I got 20 millions rows, what is the fastest way to do this? thanks Peter -- You received this message because you

[h2] index doesn't speed up

2022-12-18 Thread mche...@gmail.com
hi i have 20 millions rows , and this index doesn't speed up the query, please help: create index mem on data(mem, sequence); select * from data where mem is not null order by sequence mem is varchar(200); and sequence is bigint thanks -- You received this message because you are subscrib

Re: [h2] index doesn't speed up

2022-12-18 Thread Andreas Reichel
Greetings! As far as I remember, H2 considers composite indices only in certain situations -- but not for all possible optimisations. Please EXPLAIN your query to check, if the index has been considered (I guess, it has not). Maybe try again with 2 different indices, one for MEM and one for SEQUE

Re: [h2] index doesn't speed up

2022-12-18 Thread Andreas Reichel
From https://www.h2database.com/html/performance.html: This database uses indexes to improve the performance ofSELECT, UPDATE, DELETE. If a column is used in the WHERE clause of a query, and if an index exists on this column, then the index can be used. Multi-column indexes are used if all or the

[h2] Re: int not 100% continuous

2022-12-18 Thread Evgenij Ryazanov
Hi! If you don't care about exact ordering, the fastest way is UPDATE tableName SET columnName = ROWNUM(); If you want to preserve it, a slower command is needed: MERGE INTO tableName USING (SELECT columnName, ROW_NUMBER() OVER(ORDER BY columnName) FROM tableName) T(columnName, R) ON tableName.c

[h2] Re: int not 100% continuous

2022-12-18 Thread mche...@gmail.com
thank you very much :-) On Sunday, 18 December 2022 at 19:47:59 UTC+8 Evgenij Ryazanov wrote: > Hi! > > If you don't care about exact ordering, the fastest way is > UPDATE tableName SET columnName = ROWNUM(); > > If you want to preserve it, a slower command is needed: > MERGE INTO tableName USING