Re: [google-cloud-sql-discuss] Google Cloud Database doesn't support MyISAM, so how I am going to achieve this in InnoDB?

27 views
Skip to first unread message
Message has been deleted

Pavel Ivanov

unread,
Jul 29, 2019, 1:53:58 PM7/29/19
to google-cloud...@googlegroups.com
Can you say why do you want to achieve that? What's wrong with all ids
being unique?

On Mon, Jul 29, 2019 at 10:25 AM Gerth Ermel <gerth...@gmail.com> wrote:
>
> Basically what I want to do is to have Auto Incremental Primary Key id, that resets when two column combo is unique.
>
> This is how the database would look
> +--------+----+---------+
> | grp | id | name |
> +--------+----+---------+
> | fish | 1 | lax |
> | mammal | 1 | dog |
> | mammal | 2 | cat |
> | mammal | 3 | whale |
> | bird | 1 | penguin |
> | bird | 2 | ostrich |
> +--------+----+---------+
>
> and this would be the query that creates table...
>
> CREATE TABLE animals (
> grp ENUM('fish','mammal','bird') NOT NULL,
> id MEDIUMINT NOT NULL AUTO_INCREMENT,
> name CHAR(30) NOT NULL,
> PRIMARY KEY (grp,id)
> ) ENGINE=MyISAM;
>
>
> ...But as Google Cloud don't support MyISAM, how I can achieve same thing in InnoDB?
>
> --
> You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-d...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/1545bd4b-cb3f-42df-8780-935d978b7689%40googlegroups.com.
Message has been deleted

Julie (cloud platform support)

unread,
Jul 29, 2019, 3:24:01 PM7/29/19
to Google Cloud SQL discuss
This document goes through the AUTO_INCREMENT Handling in InnoDB and provides examples and syntax. The issue with your use case is the lack of a primary unique key which is best practice for row-based replication so specifying a row will be difficult. 
Reply all
Reply to author
Forward
0 new messages