You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Check Peck <co...@gmail.com> on 2020/06/30 17:42:51 UTC

Better way to define UDT's in Cassandra

We are trying to remove two columns in a table with 3 and make them UDT
instead of having them as columns. So we came up with two options below. I
wanted to understand if there is any difference between these two UDT in
the Cassandra database?


*One option is:*

>     CREATE TYPE test_type (
>         cid int,
>         type text,
>         hid int
>     );


and then using like this in a table definition

    test_types set<frozen<test_type>>,


vs

*Second option is:*

    CREATE TYPE test_type (
>         type text,
>         hid int
>     );


and then using like this in a table definition

    test_types map<int, frozen<test_type>


So just curious which one is the preferred option here for performance
related or they both are the same?

Re: Better way to define UDT's in Cassandra

Posted by Check Peck <co...@gmail.com>.
Following up again on this. Any thoughts on this?

Re: Better way to define UDT's in Cassandra

Posted by Check Peck <co...@gmail.com>.
Does anyone have any thoughts on this?

On Tue, Jun 30, 2020 at 10:42 AM Check Peck <co...@gmail.com> wrote:

> We are trying to remove two columns in a table with 3 and make them UDT
> instead of having them as columns. So we came up with two options below. I
> wanted to understand if there is any difference between these two UDT in
> the Cassandra database?
>
>
> *One option is:*
>
>>     CREATE TYPE test_type (
>>         cid int,
>>         type text,
>>         hid int
>>     );
>
>
> and then using like this in a table definition
>
>     test_types set<frozen<test_type>>,
>
>
> vs
>
> *Second option is:*
>
>     CREATE TYPE test_type (
>>         type text,
>>         hid int
>>     );
>
>
> and then using like this in a table definition
>
>     test_types map<int, frozen<test_type>
>
>
> So just curious which one is the preferred option here for performance
> related or they both are the same?
>