StarRocks / starrocks

StarRocks, a Linux Foundation project, is a next-generation sub-second MPP OLAP database for full analytics scenarios, including multi-dimensional analytics, real-time analytics, and ad-hoc queries.
https://starrocks.io
Apache License 2.0
8.62k stars 1.74k forks source link

Support changing start value for auto increment column #47282

Open eshishki opened 2 months ago

eshishki commented 2 months ago

Currently Starrocks supports auto increment column value generation, but it doesn't support changing starting value.

It limits application migration to starrocks.

Suppose i have a legacy mysql database and application that assigns values using auto increment. I want to migrate to starrocks. I would load my historical data, and i would need to set starting auto increment value to max of my current loaded value. Afterwards it would just work.

Currently, i have to change my application to use manual id assignment, this is a lot harder and limits user migration.

jaogoy commented 2 months ago

Yes, you're right. It needs to be implemented.

PayThePiper commented 2 months ago

We have the same issue while we are migrating to StarRocks. We would LOVE this feature!

jaogoy commented 2 weeks ago

@eshishki Can you share more your scenarios? Why do u want to use the same auto increment column, part data from MySQL, and part data for SR to create new auto IDs? Is this MySQL table a dictionary table? Or you just want to assign every row with a unique ID? If it is, what' the purpose?

AUTO INCREMENT column in SR is used to create global dictionaries, to assign a unique ID for a STRING column. Then the performance of computing exact distinct count and JOIN will be better.