Monday, July 29, 2019

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

I have this application, that needs to order items in specific order. Each listing order start with 0, so when I first loop through the data, item with id 1 gets inserted as a starting point. I could rework this part, where I just compare each id and if id is smaller than previous, then that item gets set as starting item. This aint that much of a problem, other having to spend extra time on reworking a thing that is already working, just because of Google.
The thing is, if database table structure is in way that each row has always unique id, then when user insert new item the frontend has to wait till backend has done the insert query and returned the id of row that was just inserted. After that frontend can create field and user can start filling up that field with information. But when database table structure is in a way that user 1 has items with id 1,2,3 and user 2 has items with 1,2,3,4, then when I, as user 1, was to insert new item, I already know that next item id is going to be 4. So the frontend doesn't have to wait behind backend to be done with insert query and returning the id. While backend is inserting the row, the frontend has already created a field and user can already start filling up that field with information.

On Monday, July 29, 2019 at 8:53:58 PM UTC+3, Pavel Ivanov wrote:
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-discuss+unsubscribe@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.

--
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-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/0da0c1e6-9e52-4a2f-a77f-1b845d591632%40googlegroups.com.

No comments:

Post a Comment