Toast and slice of toast

Started by Rémi Curaabout 12 years ago4 messagesgeneral
Jump to latest
#1Rémi Cura
remi.cura@gmail.com

Hey Dear List,
could somebody point me to some ressources about getting only parts of
toasted data?

I have a very big custom type and I would like to take blocks of it (like
byte A to B then byte C to D then... ).

I found a function in
http://doxygen.postgresql.org/tuptoaster_8c.html#called
toast_fetch_datum_slice, is it the right way to use it
(a for loop and calling it several time?).

Thanks,

Cheers

Rémi-C

#2Haribabu Kommi
kommi.haribabu@gmail.com
In reply to: Rémi Cura (#1)
Re: Toast and slice of toast

On Sun, Feb 16, 2014 at 9:38 PM, Rémi Cura <remi.cura@gmail.com> wrote:

Hey Dear List,
could somebody point me to some ressources about getting only parts of
toasted data?

I have a very big custom type and I would like to take blocks of it (like
byte A to B then byte C to D then... ).

I found a function in http://doxygen.postgresql.org/tuptoaster_8c.html#called toast_fetch_datum_slice, is it the right way to use it
(a for loop and calling it several time?).

"pg_detoast_datum_slice" is the function which will solve your problem.

Regards,
Hari Babu
Fujitsu Australia

#3Andres Freund
andres@anarazel.de
In reply to: Haribabu Kommi (#2)
Re: Toast and slice of toast

On 2014-02-17 14:16:33 +1100, Haribabu Kommi wrote:

On Sun, Feb 16, 2014 at 9:38 PM, R�mi Cura <remi.cura@gmail.com> wrote:

Hey Dear List,
could somebody point me to some ressources about getting only parts of
toasted data?

I have a very big custom type and I would like to take blocks of it (like
byte A to B then byte C to D then... ).

I found a function in http://doxygen.postgresql.org/tuptoaster_8c.html#called toast_fetch_datum_slice, is it the right way to use it
(a for loop and calling it several time?).

"pg_detoast_datum_slice" is the function which will solve your problem.

Note that you need to prevent your type/column from being compressed for
that being effective. Check the storage options for CREATE TABLE et al.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#4Rémi Cura
remi.cura@gmail.com
In reply to: Andres Freund (#3)
Re: Toast and slice of toast

Thanks everybody !

Cheers,

Rémi-C

2014-02-17 10:37 GMT+01:00 Andres Freund <andres@2ndquadrant.com>:

Show quoted text

On 2014-02-17 14:16:33 +1100, Haribabu Kommi wrote:

On Sun, Feb 16, 2014 at 9:38 PM, Rémi Cura <remi.cura@gmail.com> wrote:

Hey Dear List,
could somebody point me to some ressources about getting only parts of
toasted data?

I have a very big custom type and I would like to take blocks of it

(like

byte A to B then byte C to D then... ).

I found a function in

http://doxygen.postgresql.org/tuptoaster_8c.html#calledtoast_fetch_datum_slice, is it the right way to use it

(a for loop and calling it several time?).

"pg_detoast_datum_slice" is the function which will solve your problem.

Note that you need to prevent your type/column from being compressed for
that being effective. Check the storage options for CREATE TABLE et al.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services