0

Can you share any information on the impact of an “add column” type of operation when workload is still running/real deployment scenarios? We would like to know about this capability for both YSQL and YCQL APIs of YugabyteDB.

1 Answers1

0

Yes. There is ALTER TABLE support on both YSQL & YCQL.

https://docs.yugabyte.com/latest/api/ycql/ddl_alter_table/#add-a-column-to-a-table https://docs.yugabyte.com/latest/api/ysql/commands/ddl_alter_table/

Example: ALTER TABLE employees ADD title TEXT; will add a new title column of type TEXT.

dh YB
  • 965
  • 3
  • 10
  • 1
    Online schema change in YugaByte may have issues (I hope the developers may fix these issues though!). An example here shows how doing an online `CREATE INDEX` in YugaByte v2.0.0 leads to inconsistent data: https://www.cockroachlabs.com/blog/unpacking-competitive-benchmarks/#initial So, be careful, maybe discuss with the YugaByte developers and/or plan maintenance time to apply schema changes (for now). – David Baird Apr 06 '20 at 02:31
  • 1
    @DavidBaird we're are actively working to support backfilling indexes: https://github.com/yugabyte/yugabyte-db/issues/2301 . We also support most ALTER TABLE commands in Postgresql and more are in the way https://github.com/yugabyte/yugabyte-db/issues/1124 . You can ask on our slack,forum or here for any issue. – dh YB Apr 07 '20 at 12:30
  • The [Jepsen test](https://jepsen.io/analyses/yugabyte-db-1.3.1) published in September, 2019 showed a number of consistency issues with DDL operations. There's also an [open issue](https://github.com/yugabyte/yugabyte-db/issues/4192) describing support for online schema migrations, specifically "DDL operations can be safely run as a part of schema migrations concurrently with foreground operations." As of today, most of them are not marked "Safe for online `ALTER`", but adding a column is (which is what the original asker was asking). – Dave Pacheco May 20 '20 at 21:25
  • @DavePacheco "Safe for onlin ALTER" means the operation is done asynchronously, the table will not be locked. They still work though. Ex: adding a column with default value will block until the table is populated. This was true even for Postgresql until recent versions. – dh YB May 28 '20 at 07:59