Re: The Tutorial(TM)

From: Bret Busby <bret(at)busby(dot)net>
To: pgsql-docs(at)postgresql(dot)org
Subject: Re: The Tutorial(TM)
Date: 2004-01-11 04:13:14
Message-ID: Pine.LNX.4.44.0401111151280.17635-100000@BBRH73.busby.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Thu, 8 Jan 2004, David Fetter wrote:

>
> Christopher Browne <cbbrowne(at)acm(dot)org> wrote:
> > Oops! david(at)fetter(dot)org (David Fetter) was seen spray-painting on a wall:
> >> On Thu, Jan 08, 2004 at 06:07:13PM +0100, Peter Eisentraut wrote:
> >>> David Fetter wrote:
> >>> > Expanding on that, putting FK's in "Advanced Features" gives the
> >>> > (IME always wrong) impression that they're optional.
> >>>
> >>> They *are* optional.
> >>
> >> I disagree.
> >>
> >>> The first chapter is about getting the data in and out. That is
> >>> not optional for using a database. Transactions, views, foreign
> >>> keys, primary keys even, and everything else that some people
> >>> think is essential for a "real" database are in fact optional.
> >>> Remember that the tutorial is intended for people starting from
> >>> zero.
> >>
> >> No, they're not optional. If people see how it's done right,
> >> starting from zero, they will not then develop bad habits that have
> >> to be un-learned.
> >>
> >>> Let's not overwhelm them right away.
> >>
> >> I don't think this will be overwhelming.
> >
> > When some Pointy-Haired Type has some ridiculously large list of
> > things that they say are all "top priorities," that implies that all
> > are of equally _LOW_ priority.
>
> Good point. How about this, then? For the table create scripts at
> the beginning, I'll put in FK's with a pointer to the DB design
> section, and just go with 'em from there. That way, people get used
> to seeing and doing things the right way, even if they don't
> understand them right off the bat.
>
> > I rather like Tom Lane's suggestion that it makes sense to split into
> > _three_ sections:
> >
> > 1. Rudimentary queries, where novices figure out the basics of
> > SELECT, INSERT, DELETE, UPDATE. Perhaps with simple joins.
> >
> > 2. Intermediate queries, where more complex joins, views,
> > transactions, subselects, some mention of vacuum/analyze/explain
> > and such, are presented.
> >
> > 3. The "advanced" part might instead get called "Designing
> > Databases," and present foreign keys, stored procedures,
> > triggers, and such.
>
> > Foreign keys would _naturally_ flow into the section that is on
> > design, as they are a "design" matter.
>
> Excellent :)
>
> Cheers,
> D
>

As a person who is not a PostgreSQL guru or a database guru, or who
has worked on databases with the numbers of tables in the hundreds
or thousands, but, a person with (relatively) basic database skills, and
who knows of relational database design and the need for normalisation,
I suggest that wariness of cross-references, etc, should exist.

I suggest that Foreign Keys should be included as a subsection to
creating tables, and to altering tables, which are the places, to me, in
which they belong. When I create a table, or am learning to do it with
PostgreSQL, having to follow cross-references, to find how to do what
should be a relatively simple and elementary task, would make the
process unnecessarily cumbersome, and would be a disincentive to use
foreign keys.

I believe that a person creating a database, and the tables, should
have, at that stage, the information required for the components;
primary keys, foreign keys, etc, so that the person can create the
database and get it properly operational, before entering data.

A proverb exists; "Do it once - do it properly", and, if a person does
it properly from the start, the process is much more efficient.

What is the point in using PostgreSQL to build a flat-file database,
then tearing it apart, to implement elementary relational concepts like
foreign keys?

And, if a person has to go looking elsewhere, via cross-references, for
concepts like foreign keys, they may fall by the wayside, and, may be
reagarded as unimportant, as they are not included in the part for
creating the tables.

Thus, I suggest that the sections should be CREATE TABLE and ALTER
TABLE, and they should include subsections like PRIMARY KEYS and FOREIGN
KEYS, so that the person can do it properly from the start, and, not be
discouraged from using foreign keys, by the use of cross-referencing.

After all, you must consider the level for whom the tutorials are to be
written; are they for gurus, like (some of) you, or, for basic level
people, like me?

--
Bret Busby
Armadale
West Australia
..............

"So once you do know what the question actually is,
you'll know what the answer means."
- Deep Thought,
Chapter 28 of
"The Hitchhiker's Guide to the Galaxy:
A Trilogy In Four Parts",
written by Douglas Adams,
published by Pan Books, 1992
....................................................

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Bret Busby 2004-01-11 04:24:10 Re: The Tutorial(TM)
Previous Message Shridhar Daithankar 2004-01-09 07:01:09 Re: The Tutorial(TM)