32KB Tuples

Started by Eric Jainalmost 26 years ago6 messagesgeneral
Jump to latest
#1Eric Jain
jain@gmx.net

What exactly is the reason, why PostgreSQL doesn't use 32KB tuples by
default? Performance? Disk space? Both?

--
Eric Jain

#2Bruce Momjian
bruce@momjian.us
In reply to: Eric Jain (#1)
Re: 32KB Tuples

[ Charset ISO-8859-1 unsupported, converting... ]

What exactly is the reason, why PostgreSQL doesn't use 32KB tuples by
default? Performance? Disk space? Both?

Both.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#3Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#2)
Re: 32KB Tuples

[ Charset ISO-8859-1 unsupported, converting... ]

What exactly is the reason, why PostgreSQL doesn't use

32KB tuples by

default? Performance? Disk space? Both?

Both.

How big is the impact on performance, approximately?

(= Has anyone done any benchmarks?)

No benchmarks. Can you do them?

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#4Eric Jain
jain@gmx.net
In reply to: Bruce Momjian (#2)
RE: 32KB Tuples

What exactly is the reason, why PostgreSQL doesn't use

32KB tuples by

default? Performance? Disk space? Both?

Both.

How big is the impact on performance, approximately?

(= Has anyone done any benchmarks?)

--
Eric Jain

#5Patrick Welche
prlw1@newn.cam.ac.uk
In reply to: Bruce Momjian (#3)
Re: 32KB Tuples

What exactly is a "tuple"? One entire row of a table? Or one "line" of a
reply to a query? (I suspect it's the entire row of a table, but I have had
a case with text fields, where one field was updated with about 7k. All
selects would deal either with that field or the others. The first time the
8k limit struck was with with a pg_dump/restore were obviously the entire
row was used, so maybe it's just the size of the reply?)

Cheers,

Patrick

#6Jurgen Defurne
defurnj@glo.be
In reply to: Eric Jain (#4)
Re: 32KB Tuples

Patrick Welche wrote:

On Tue, Jun 06, 2000 at 06:42:08PM +0200, Jurgen Defurne wrote:

A 'tuple' is an element of a set. A set is also called a table. When you do N
insertions on a table, then you get a table/set of N tuples. When you
query a table/set, then your result is also a set. This set can consist of
0 to N tuples.

To put it in another perspective :
tuple <-> row <-> record
relation <-> table <-> 'file'

Since SQL manipulates sets, giving other sets, your first thought, is also
correct.

The other part of you question deals with projection, which means that
you only take some fields. However, if you do a query like
SELECT * FROM table WHERE select condition
OR
SELECT field1, field2 FROM table WHERE select condition

both will return the same number of tuples, but in the second set, the
tuples will consist of only two fields.

So where is the 8K or 32K limit? For the
SELECT * FROM table WHERE select condition
or the
SELECT field1, field2 FROM table WHERE select condition
case?

Cheers,

Patrick

The limit is in the length of the tuple of a base table. Counting the lengths
of all fields in a tuple together may not be larger than 8192 bytes
(or 32768 bytes if you changed your configuration).

Suppose you have a tuple with 1 text field, then you will not be able to
store more than 8192 bytes in the field. If you have two text fields, then
if field 1 contains N bytes, then field 2 can only contain 8192 - N bytes.

The limits are not in the SQL statements, but in the physical files which
are used to create the tables.

Jurgen Defurne
defurnj@glo.be