You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by "Cox, Jonathan A" <ja...@sandia.gov> on 2016/03/30 22:57:04 UTC

TEXT Data type in Phoenix?

Is it possible to have the equivalent of the SQL data type "TEXT" with Phoenix? The reason being, my data has columns with unspecified text length. If I go with a varchar,  loading the entire CSV file into the database may fail if one entry is too long.

Maybe, however, there is really no reason to use TEXT with Phoenix? Perhaps just using VARCHAR with a very long size is equivalent in terms of performance and memory usage (given that Phoenix is HBase under the hood)?

Thanks,
Jon

Re: [EXTERNAL] Re: TEXT Data type in Phoenix?

Posted by Sergey Soldatov <se...@gmail.com>.
Jon,
I believe that it's just only metadata stuff. The VARCHAR
implementation itself doesn't rely on the size.

Thanks,
Sergey

On Wed, Mar 30, 2016 at 4:51 PM, Cox, Jonathan A <ja...@sandia.gov> wrote:
> Sergey,
>
> Thanks for the tip. Is there any real performance reason (memory or speed) to use a pre-defined length for VARCHAR? Or is it really all the same under the hood?
>
> -Jonathan
>
> -----Original Message-----
> From: sergey.soldatov@gmail.com [mailto:sergey.soldatov@gmail.com] On Behalf Of Sergey Soldatov
> Sent: Wednesday, March 30, 2016 5:38 PM
> To: user@phoenix.apache.org
> Subject: [EXTERNAL] Re: TEXT Data type in Phoenix?
>
> Jon,
> It seems that documentation is a bit outdated. VARCHAR supports exactly what you want:
> create table x (id bigint primary key, x varchar); upsert into x values (1, "..... (a lot of text there) " );
> 0: jdbc:phoenix:localhost> select length(x) from x;
> +------------+
> | LENGTH(X)  |
> +------------+
> | 1219       |
> +------------+
> 1 row selected (0.009 seconds)
>
> Thanks,
> Sergey
>
> On Wed, Mar 30, 2016 at 1:57 PM, Cox, Jonathan A <ja...@sandia.gov> wrote:
>> Is it possible to have the equivalent of the SQL data type “TEXT” with
>> Phoenix? The reason being, my data has columns with unspecified text length.
>> If I go with a varchar,  loading the entire CSV file into the database
>> may fail if one entry is too long.
>>
>>
>>
>> Maybe, however, there is really no reason to use TEXT with Phoenix?
>> Perhaps just using VARCHAR with a very long size is equivalent in
>> terms of performance and memory usage (given that Phoenix is HBase under the hood)?
>>
>>
>>
>> Thanks,
>>
>> Jon

RE: [EXTERNAL] Re: TEXT Data type in Phoenix?

Posted by "Cox, Jonathan A" <ja...@sandia.gov>.
Sergey,

Thanks for the tip. Is there any real performance reason (memory or speed) to use a pre-defined length for VARCHAR? Or is it really all the same under the hood?

-Jonathan

-----Original Message-----
From: sergey.soldatov@gmail.com [mailto:sergey.soldatov@gmail.com] On Behalf Of Sergey Soldatov
Sent: Wednesday, March 30, 2016 5:38 PM
To: user@phoenix.apache.org
Subject: [EXTERNAL] Re: TEXT Data type in Phoenix?

Jon,
It seems that documentation is a bit outdated. VARCHAR supports exactly what you want:
create table x (id bigint primary key, x varchar); upsert into x values (1, "..... (a lot of text there) " );
0: jdbc:phoenix:localhost> select length(x) from x;
+------------+
| LENGTH(X)  |
+------------+
| 1219       |
+------------+
1 row selected (0.009 seconds)

Thanks,
Sergey

On Wed, Mar 30, 2016 at 1:57 PM, Cox, Jonathan A <ja...@sandia.gov> wrote:
> Is it possible to have the equivalent of the SQL data type “TEXT” with 
> Phoenix? The reason being, my data has columns with unspecified text length.
> If I go with a varchar,  loading the entire CSV file into the database 
> may fail if one entry is too long.
>
>
>
> Maybe, however, there is really no reason to use TEXT with Phoenix? 
> Perhaps just using VARCHAR with a very long size is equivalent in 
> terms of performance and memory usage (given that Phoenix is HBase under the hood)?
>
>
>
> Thanks,
>
> Jon

Re: TEXT Data type in Phoenix?

Posted by Sergey Soldatov <se...@gmail.com>.
Jon,
It seems that documentation is a bit outdated. VARCHAR supports
exactly what you want:
create table x (id bigint primary key, x varchar);
upsert into x values (1, "..... (a lot of text there) " );
0: jdbc:phoenix:localhost> select length(x) from x;
+------------+
| LENGTH(X)  |
+------------+
| 1219       |
+------------+
1 row selected (0.009 seconds)

Thanks,
Sergey

On Wed, Mar 30, 2016 at 1:57 PM, Cox, Jonathan A <ja...@sandia.gov> wrote:
> Is it possible to have the equivalent of the SQL data type “TEXT” with
> Phoenix? The reason being, my data has columns with unspecified text length.
> If I go with a varchar,  loading the entire CSV file into the database may
> fail if one entry is too long.
>
>
>
> Maybe, however, there is really no reason to use TEXT with Phoenix? Perhaps
> just using VARCHAR with a very long size is equivalent in terms of
> performance and memory usage (given that Phoenix is HBase under the hood)?
>
>
>
> Thanks,
>
> Jon