Disk space consumption: character varying(255) versus text used for index

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Disk space consumption: character varying(255) versus text used for index

Marcel Ruff-2
Hi,

my btree index for

   guid                | character varying(255)

is currently 6.9GB (almost all guid entries are of size 37bytes)

If I would change the data type to

  guid                | text

would the index size be reduced (without hitting performance)?

thank you
Marcel


--
NetwakeVision
Alte Owinger Straße 100
D-88662 Überlingen
Phone: +49 7551 309372
http://www.netwakevision.com
http://www.royal-gps.com
Reply | Threaded
Open this post in threaded view
|

Re: Disk space consumption: character varying(255) versus text used for index

Tom Lane-2
Marcel Ruff <[hidden email]> writes:
> my btree index for
>    guid                | character varying(255)
> is currently 6.9GB (almost all guid entries are of size 37bytes)
> If I would change the data type to
>   guid                | text
> would the index size be reduced (without hitting performance)?

Wouldn't make any difference at all.

                        regards, tom lane


Reply | Threaded
Open this post in threaded view
|

Re: Disk space consumption: character varying(255) versus text used for index

Justin-2
Have question this states the GUID  is the text Hex value form a UUID  if so that 36bytes long  vs integer that is 128bits   if that is the case convert this GUID to  UUID type 

or am i missing something?

On Fri, Dec 20, 2019 at 1:55 PM Tom Lane <[hidden email]> wrote:
Marcel Ruff <[hidden email]> writes:
> my btree index for
>    guid                | character varying(255)
> is currently 6.9GB (almost all guid entries are of size 37bytes)
> If I would change the data type to
>   guid                | text
> would the index size be reduced (without hitting performance)?

Wouldn't make any difference at all.

                        regards, tom lane


Reply | Threaded
Open this post in threaded view
|

RE: Disk space consumption: character varying(255) versus text used for index

Stephen Froehlich

Just to make it a little more clear, PostgreSQL has a binary UUID type that should house your GUID’s perfectly efficiently. (It also provides a lot of other useful functionality and speed improvements):

 

https://www.postgresql.org/docs/12/datatype-uuid.html

 

 

 

From: Justin <[hidden email]>
Sent: Friday, December 20, 2019 12:06 PM
To: Tom Lane <[hidden email]>
Cc: [hidden email]; [hidden email]
Subject: Re: Disk space consumption: character varying(255) versus text used for index

 

Have question this states the GUID  is the text Hex value form a UUID  if so that 36bytes long  vs integer that is 128bits   if that is the case convert this GUID to  UUID type 

 

or am i missing something?

 

On Fri, Dec 20, 2019 at 1:55 PM Tom Lane <[hidden email]> wrote:

Marcel Ruff <[hidden email]> writes:
> my btree index for
>    guid                | character varying(255)
> is currently 6.9GB (almost all guid entries are of size 37bytes)
> If I would change the data type to
>   guid                | text
> would the index size be reduced (without hitting performance)?

Wouldn't make any difference at all.

                        regards, tom lane

Reply | Threaded
Open this post in threaded view
|

Re: Disk space consumption: character varying(255) versus text used for index

Marcel Ruff-2
Thank you for the hints, this helps a lot.

I love PostgreSQL,

Marcel

Am 21.12.19 um 15:41 schrieb Stephen Froehlich:

Just to make it a little more clear, PostgreSQL has a binary UUID type that should house your GUID’s perfectly efficiently. (It also provides a lot of other useful functionality and speed improvements):

 

https://www.postgresql.org/docs/12/datatype-uuid.html

 

 

 

From: Justin [hidden email]
Sent: Friday, December 20, 2019 12:06 PM
To: Tom Lane [hidden email]
Cc: [hidden email]; [hidden email]
Subject: Re: Disk space consumption: character varying(255) versus text used for index

 

Have question this states the GUID  is the text Hex value form a UUID  if so that 36bytes long  vs integer that is 128bits   if that is the case convert this GUID to  UUID type 

 

or am i missing something?

 

On Fri, Dec 20, 2019 at 1:55 PM Tom Lane <[hidden email]> wrote:

Marcel Ruff <[hidden email]> writes:
> my btree index for
>    guid                | character varying(255)
> is currently 6.9GB (almost all guid entries are of size 37bytes)
> If I would change the data type to
>   guid                | text
> would the index size be reduced (without hitting performance)?

Wouldn't make any difference at all.

                        regards, tom lane


--
NetwakeVision
Alte Owinger Straße 100
D-88662 Überlingen
Phone: +49 7551 309372
http://www.netwakevision.com
http://www.royal-gps.com