As part of a database migration, I need to add a few columns to an existing table in production. It seems to be very slow adding columns to a table with 100K+ rows and 60 columns. So I made an isolated test:
drop table if exists test; create table test (id integer, id2 integer, i3 integer, i4 integer); insert into test select x, x, x, x from system_range(1, 100000); alter table test add column new_column integer; alter table test add column another_new_column integer; alter table test add column yet_another_new_column integer; Here's the console output: drop table if exists test; Update count: 0 (18 ms) create table test (id integer, id2 integer, i3 integer, i4 integer); Update count: 0 (0 ms) insert into test select x, x, x, x from system_range(1, 100000); Update count: 100000 (1053 ms) alter table test add column new_column integer; Update count: 0 (1281 ms) alter table test add column another_new_column integer; Update count: 0 (1677 ms) Adding a single column takes longer than populating the database initially. What are some ways (if any) in which I can speed up this process? (The real life scenario takes 70 seconds per column I add). --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
