What is a tuple?

Started by Elaine Lindelefalmost 24 years ago15 messagesgeneral
Jump to latest
#1Elaine Lindelef
eel@cognitivity.com

My apologies for the stupid question, but before I started using
postgres I never came across the word "tuple" quite in this context
before. I know a "tuple" as "a data object containing two or more
components" ... but I'm not sure of its precise meaning in the
postgres universe. Is a tuple a row, a field value, a field value
paired with its datatype, what? If someone asks me the size of my
largest tuple, how do I calculate it? It seems to be related deeply
to the structure of postgres somehow.

Thanks for your patience.

Elaine

#2Timothy Reaves
treaves@silverfields.com
In reply to: Elaine Lindelef (#1)
Re: What is a tuple?

On Tue, 25 Jun 2002 14:40:03 -0700
Elaine Lindelef <eel@cognitivity.com> wrote:

My apologies for the stupid question, but before I started using
postgres I never came across the word "tuple" quite in this context
before. I know a "tuple" as "a data object containing two or more
components" ... but I'm not sure of its precise meaning in the
postgres universe. Is a tuple a row, a field value, a field value
paired with its datatype, what? If someone asks me the size of my
largest tuple, how do I calculate it? It seems to be related deeply
to the structure of postgres somehow.

A 'tuple' is not a database - nor PostgreSQL - term. It is a
mathimatical term meaing a set. Withen the context of databases, a tuple
is always a row. 'Tuples' refers to the tuple set, or row set.

#3Martijn van Oosterhout
kleptog@svana.org
In reply to: Elaine Lindelef (#1)
Re: What is a tuple?

On Tue, Jun 25, 2002 at 02:40:03PM -0700, Elaine Lindelef wrote:

My apologies for the stupid question, but before I started using
postgres I never came across the word "tuple" quite in this context
before. I know a "tuple" as "a data object containing two or more
components" ... but I'm not sure of its precise meaning in the
postgres universe. Is a tuple a row, a field value, a field value
paired with its datatype, what? If someone asks me the size of my
largest tuple, how do I calculate it? It seems to be related deeply
to the structure of postgres somehow.

A tuple is a row. Isn't this in the glossary somewhere?
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/

Show quoted text

There are 10 kinds of people in the world, those that can do binary
arithmetic and those that can't.

#4Rich Shepard
rshepard@appl-ecosys.com
In reply to: Timothy Reaves (#2)
Re: What is a tuple?

On Tue, 25 Jun 2002, Timothy Reaves wrote:

A 'tuple' is not a database - nor PostgreSQL - term. It is a
mathimatical term meaing a set. Withen the context of databases, a tuple
is always a row. 'Tuples' refers to the tuple set, or row set.

And, in the same mathematical language of relational databases, what we
commonly call a "table" is a "relation". "Columns" are called "attributes".

A good database management book will teach you the vocabulary.

Rich

Dr. Richard B. Shepard, President

Applied Ecosystem Services, Inc. (TM)
2404 SW 22nd Street | Troutdale, OR 97060-1247 | U.S.A.
+ 1 503-667-4517 (voice) | + 1 503-667-8863 (fax) | rshepard@appl-ecosys.com
http://www.appl-ecosys.com

#5Bruce Momjian
bruce@momjian.us
In reply to: Martijn van Oosterhout (#3)
Re: What is a tuple?

Martijn van Oosterhout wrote:

On Tue, Jun 25, 2002 at 02:40:03PM -0700, Elaine Lindelef wrote:

My apologies for the stupid question, but before I started using
postgres I never came across the word "tuple" quite in this context
before. I know a "tuple" as "a data object containing two or more
components" ... but I'm not sure of its precise meaning in the
postgres universe. Is a tuple a row, a field value, a field value
paired with its datatype, what? If someone asks me the size of my
largest tuple, how do I calculate it? It seems to be related deeply
to the structure of postgres somehow.

A tuple is a row. Isn't this in the glossary somewhere?

It's in the FAQ.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  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
#6Elaine Lindelef
eel@cognitivity.com
In reply to: Bruce Momjian (#5)
Re: What is a tuple?

A tuple is a row. Isn't this in the glossary somewhere?

It's in the FAQ.

Thank you all for your help. Tuple = Row ; that makes sense.

However, I do want to assure you that I spent some time on the
postgresql.org website trying to find this information:

- What glossary? I really did look hard!

- No, it's not in the (English) FAQ. The only line about tuples is:

"5.3) How do I write a C function to return a tuple?
This requires wizardry so extreme that the authors have never
tried it, though in principle it can be done."

And, since other areas of the FAQ and documentation use "row", it's
easy to suspect that perhaps there's a different meaning for "tuple."
(I presume what really happened is that different writers happened to
prefer different vocabulary.)

Perhaps someone would be kind enough to add this to the FAQ, or make
the glossary more prominent on the site if it is explained there.

Elaine

#7Bruce Momjian
bruce@momjian.us
In reply to: Elaine Lindelef (#6)
Re: What is a tuple?

Elaine Lindelef wrote:

A tuple is a row. Isn't this in the glossary somewhere?

It's in the FAQ.

Thank you all for your help. Tuple = Row ; that makes sense.

However, I do want to assure you that I spent some time on the
postgresql.org website trying to find this information:

- What glossary? I really did look hard!

- No, it's not in the (English) FAQ. The only line about tuples is:

"5.3) How do I write a C function to return a tuple?
This requires wizardry so extreme that the authors have never
tried it, though in principle it can be done."

And, since other areas of the FAQ and documentation use "row", it's
easy to suspect that perhaps there's a different meaning for "tuple."
(I presume what really happened is that different writers happened to
prefer different vocabulary.)

Perhaps someone would be kind enough to add this to the FAQ, or make
the glossary more prominent on the site if it is explained there.

Already in the FAQ:

<H4><A name="4.17">4.17</A>) What is the meaning of some of the
terms used in PostgreSQL?</H4>

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  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
/usr/local/bin/mime: cannot create /dev/ttyp3: permission denied
#8ktt
kestutis98@yahoo.com
In reply to: Bruce Momjian (#7)
Re: What is a tuple?

this is that i've found in webopedia:

tuple=record

&

record=In database management systems, a complete set
of information.

i.e.

tuple in database management systems = a complete set
of information.

http://www.webopedia.com/TERM/t/tuple.html

--- Bruce Momjian <pgman@candle.pha.pa.us> wrote:

Elaine Lindelef wrote:

A tuple is a row. Isn't this in the glossary

somewhere?

It's in the FAQ.

Thank you all for your help. Tuple = Row ; that

makes sense.

However, I do want to assure you that I spent some

time on the

postgresql.org website trying to find this

information:

- What glossary? I really did look hard!

- No, it's not in the (English) FAQ. The only

line about tuples is:

"5.3) How do I write a C function to return a

tuple?

This requires wizardry so extreme that the

authors have never

tried it, though in principle it can be done."

And, since other areas of the FAQ and

documentation use "row", it's

easy to suspect that perhaps there's a different

meaning for "tuple."

(I presume what really happened is that different

writers happened to

prefer different vocabulary.)

Perhaps someone would be kind enough to add this

to the FAQ, or make

the glossary more prominent on the site if it is

explained there.

Already in the FAQ:

<H4><A name="4.17">4.17</A>) What is the meaning
of some of the
terms used in PostgreSQL?</H4>

-- 
Bruce Momjian                        | 
http://candle.pha.pa.us
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
/usr/local/bin/mime: cannot create /dev/ttyp3:
permission denied

---------------------------(end of
broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

#9David Siebert
dsiebert@eclipsecat.com
In reply to: Martijn van Oosterhout (#3)
Re: What is a tuple?

Tuple = row... Why not just use row? I know what a tuple is but it seems
like a word to impress more than inform.

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of Martijn van
Oosterhout
Sent: Tuesday, June 25, 2002 10:54 PM
To: Elaine Lindelef
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] What is a tuple?

On Tue, Jun 25, 2002 at 02:40:03PM -0700, Elaine Lindelef wrote:

My apologies for the stupid question, but before I started using
postgres I never came across the word "tuple" quite in this context
before. I know a "tuple" as "a data object containing two or more
components" ... but I'm not sure of its precise meaning in the
postgres universe. Is a tuple a row, a field value, a field value
paired with its datatype, what? If someone asks me the size of my
largest tuple, how do I calculate it? It seems to be related deeply
to the structure of postgres somehow.

A tuple is a row. Isn't this in the glossary somewhere?
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/

There are 10 kinds of people in the world, those that can do binary
arithmetic and those that can't.

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

#10Curt Sampson
cjs@cynic.net
In reply to: ktt (#8)
Re: What is a tuple?

Well, maybe just to keep things fun, I'll confuse the heck out of
all you guys.

To be pedantic, "relation" and "tuple" are mathmatical terms used
in relational algebra; "table" and "row" are references to entities
in physical storage.

A relation cannot contain duplicate tuples, but a table can contain
duplicate rows. So let's look at the following:

key | value
--------+---------------------
1 | one
2 | two
2 | two

This can be a table, but not a relation. The relation wouldn't have
that last row in it.

But in fact, it gets more interesting. Tables don't actually
correspond to relations; they correspond to _relvars_, or variables
that hold relations. Given the following table "foo":

SELECT * FROM foo

key | value
--------+---------------------
1 | one
2 | two

DELETE FROM foo WHERE key = 2
SELECT * FROM foo

key | value
--------+---------------------
1 | one

The two relations you see above are obviously not equal. They're
two different relations. When you deleted that row/tuple, you
effectively assigned a new relation to the relvar "foo".

There's more like this, but it can be most effectively appreciated by
reading C. J. Date's book _An Introduction to Database Systems_.

cjs
--
Curt Sampson <cjs@cynic.net> +81 90 7737 2974 http://www.netbsd.org
Don't you know, in this new Dark Age, we're all light. --XTC

#11Martijn van Oosterhout
kleptog@svana.org
In reply to: David Siebert (#9)
Re: What is a tuple?

On Thu, Jun 27, 2002 at 09:17:22AM -0400, David Siebert wrote:

Tuple = row... Why not just use row? I know what a tuple is but it seems
like a word to impress more than inform.

I can think of a few reasons:

1. Databases have been using the term "tuple" for a very long time.
Relational algebra talks about tuples exclusively.
2. The definition of a "tuple" is precise (a set of elements). A "row" could be anything
(row in array, row on screen).
3. Whats wrong with having multiple words for the same thing anyway?

There's also:

relation == table
resultset == tuples (?)

Anyway, have a nice day :)

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of Martijn van
Oosterhout
Sent: Tuesday, June 25, 2002 10:54 PM
To: Elaine Lindelef
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] What is a tuple?

On Tue, Jun 25, 2002 at 02:40:03PM -0700, Elaine Lindelef wrote:

My apologies for the stupid question, but before I started using
postgres I never came across the word "tuple" quite in this context
before. I know a "tuple" as "a data object containing two or more
components" ... but I'm not sure of its precise meaning in the
postgres universe. Is a tuple a row, a field value, a field value
paired with its datatype, what? If someone asks me the size of my
largest tuple, how do I calculate it? It seems to be related deeply
to the structure of postgres somehow.

A tuple is a row. Isn't this in the glossary somewhere?
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/

There are 10 kinds of people in the world, those that can do binary
arithmetic and those that can't.

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/

Show quoted text

There are 10 kinds of people in the world, those that can do binary
arithmetic and those that can't.

#12Daryl Beattie
dbeattie@insystems.com
In reply to: Martijn van Oosterhout (#11)
Re: What is a tuple?

I've always wondered that myself! And this is the answer I came up with in
my head:

Tuple is an abstract term. You can use it when discussing a set of data.

Row is a physical term, referring to a row in a database table.

So, when talking about any row in any table (which may or may not be
physical), it is appropriate to use the term "tuple". But when speaking of a
database in a non-abstract sense, it is better just to say "row".

Hope my input helps. :)

- Daryl.

Show quoted text

-----Original Message-----
From: David Siebert [mailto:dsiebert@eclipsecat.com]
Sent: Thursday, June 27, 2002 9:17 AM
To: Martijn van Oosterhout
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] What is a tuple?

Tuple = row... Why not just use row? I know what a tuple is
but it seems
like a word to impress more than inform.

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of Martijn van
Oosterhout
Sent: Tuesday, June 25, 2002 10:54 PM
To: Elaine Lindelef
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] What is a tuple?

On Tue, Jun 25, 2002 at 02:40:03PM -0700, Elaine Lindelef wrote:

My apologies for the stupid question, but before I started using
postgres I never came across the word "tuple" quite in this context
before. I know a "tuple" as "a data object containing two or more
components" ... but I'm not sure of its precise meaning in the
postgres universe. Is a tuple a row, a field value, a field value
paired with its datatype, what? If someone asks me the size of my
largest tuple, how do I calculate it? It seems to be related deeply
to the structure of postgres somehow.

A tuple is a row. Isn't this in the glossary somewhere?
--
Martijn van Oosterhout <kleptog@svana.org>
http://svana.org/kleptog/

There are 10 kinds of people in the world, those that can do binary
arithmetic and those that can't.

---------------------------(end of
broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to
majordomo@postgresql.org

---------------------------(end of
broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

#13Steve Brett
SBrett@e-mis.com
In reply to: Daryl Beattie (#12)
Re: What is a tuple?

I think tuple comes from a more classical description where tables are
relations and is mainly used in the description of relational model
concepts.

Elmasri and Nevathe (Fundamentals of Database Systems) describe a tuple as a
row and don't seem to make any distinction between the two, Date
(Introduction to Database Systems) promises as full and formal description
of exactly what a tuple is but doesn't deliver it and makes the same
equivelence. At Uni we used tuples and the more formal relation language to
describe databases but at work we use rows as the language is more easily
understood.

I do agree with your point that it may be a way to impress more than inform
but think it may be just a language thing, with some people preferring one
over the other.

Steve

Show quoted text

-----Original Message-----
From: David Siebert [mailto:dsiebert@eclipsecat.com]
Sent: 27 June 2002 14:17
To: Martijn van Oosterhout
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] What is a tuple?

Tuple = row... Why not just use row? I know what a tuple is
but it seems
like a word to impress more than inform.

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of Martijn van
Oosterhout
Sent: Tuesday, June 25, 2002 10:54 PM
To: Elaine Lindelef
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] What is a tuple?

On Tue, Jun 25, 2002 at 02:40:03PM -0700, Elaine Lindelef wrote:

My apologies for the stupid question, but before I started using
postgres I never came across the word "tuple" quite in this context
before. I know a "tuple" as "a data object containing two or more
components" ... but I'm not sure of its precise meaning in the
postgres universe. Is a tuple a row, a field value, a field value
paired with its datatype, what? If someone asks me the size of my
largest tuple, how do I calculate it? It seems to be related deeply
to the structure of postgres somehow.

A tuple is a row. Isn't this in the glossary somewhere?
--
Martijn van Oosterhout <kleptog@svana.org>
http://svana.org/kleptog/

There are 10 kinds of people in the world, those that can do binary
arithmetic and those that can't.

---------------------------(end of
broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to
majordomo@postgresql.org

---------------------------(end of
broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

#14Chris Humphries
chumphries@devis.com
In reply to: David Siebert (#9)
Re: What is a tuple?

well a row is more a visualation word, when you do a select, you
get "rows" back... they look like rows...

a tuple is actually what it is. not meant to impress, but just what
it is. a tuple is defined as "a data object containing two or more
components".

hope this clears up some confusion.

-chris

=On Thu, Jun 27, 2002 at 09:17:22AM -0400,
=recieved 1.4K bytes from David Siebert containing this:

Show quoted text

Tuple = row... Why not just use row? I know what a tuple is but it seems
like a word to impress more than inform.

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of Martijn van
Oosterhout
Sent: Tuesday, June 25, 2002 10:54 PM
To: Elaine Lindelef
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] What is a tuple?

On Tue, Jun 25, 2002 at 02:40:03PM -0700, Elaine Lindelef wrote:

My apologies for the stupid question, but before I started using
postgres I never came across the word "tuple" quite in this context
before. I know a "tuple" as "a data object containing two or more
components" ... but I'm not sure of its precise meaning in the
postgres universe. Is a tuple a row, a field value, a field value
paired with its datatype, what? If someone asks me the size of my
largest tuple, how do I calculate it? It seems to be related deeply
to the structure of postgres somehow.

A tuple is a row. Isn't this in the glossary somewhere?
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/

There are 10 kinds of people in the world, those that can do binary
arithmetic and those that can't.

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

#15Josh Jore
josh@lavendergreens.org
In reply to: Chris Humphries (#14)
Re: What is a tuple?

Perhaps I've been incorrect but I've normally used 'row' when referring to
the tuple that actually exists on disk and returned by a straight SELECT

SELECT attr,attr,attr FROM ...

I've used tuple when I want to refer to the virtual, only in memory row
that is created through things like:

SELECT a.attr,b.attr FROM ... a, ... b

My point being that when I'm talking about something more abstract to use
the more abstract form. It's just sort of a way for me to keep things
straight in conversation.

Joshua b. Jore ; http://www.greentechnologist.org

On Fri, 28 Jun 2002, Chris Humphries wrote:

Show quoted text

well a row is more a visualation word, when you do a select, you
get "rows" back... they look like rows...

a tuple is actually what it is. not meant to impress, but just what
it is. a tuple is defined as "a data object containing two or more
components".

hope this clears up some confusion.

-chris

=On Thu, Jun 27, 2002 at 09:17:22AM -0400,
=recieved 1.4K bytes from David Siebert containing this:

Tuple = row... Why not just use row? I know what a tuple is but it seems
like a word to impress more than inform.

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of Martijn van
Oosterhout
Sent: Tuesday, June 25, 2002 10:54 PM
To: Elaine Lindelef
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] What is a tuple?

On Tue, Jun 25, 2002 at 02:40:03PM -0700, Elaine Lindelef wrote:

My apologies for the stupid question, but before I started using
postgres I never came across the word "tuple" quite in this context
before. I know a "tuple" as "a data object containing two or more
components" ... but I'm not sure of its precise meaning in the
postgres universe. Is a tuple a row, a field value, a field value
paired with its datatype, what? If someone asks me the size of my
largest tuple, how do I calculate it? It seems to be related deeply
to the structure of postgres somehow.

A tuple is a row. Isn't this in the glossary somewhere?
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/

There are 10 kinds of people in the world, those that can do binary
arithmetic and those that can't.

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)