Thread: Postgresql for Dummies?

Postgresql for Dummies?

From
Daniel Lerch
Date:
I need to learn how to work with PostgreSQL for work, but I am
*completely* unfamiliar with the program, almost completely unfamiliar
with databases (I've only worked with very basic databases in MS
Access), and relateively unfamiliar with using non-GUI programs.

In other words, I need a 'Postgresql for Dummies' book - something that
will start at the most basic level.  The books I've seen out there on
Amazon.com and other places all seem to be aimed at developers, though.
Where can I go to get a basic, basic, BASIC tutorial/guidebook for
learning PostgreSQL?

Thanks,

Daniel Lerch
Portland, Oregon

Re: Postgresql for Dummies?

From
Sean Davis
Date:
Installing postgres is covered pretty well in the documentation.
However, there may be a simpler way to install depending on your system
(something like an installer).  Other than the install instructions,
there are MANY online SQL tutorials that can be completed in 1-2 hours
and will teach you the basics of working with modern relational
databases and SQL.  You could let us know where you are in the process
and we could provide better direction, I suppose.

Sean

On Oct 12, 2004, at 2:52 PM, Daniel Lerch wrote:

> I need to learn how to work with PostgreSQL for work, but I am
> *completely* unfamiliar with the program, almost completely unfamiliar
> with databases (I've only worked with very basic databases in MS
> Access), and relateively unfamiliar with using non-GUI programs.
>
> In other words, I need a 'Postgresql for Dummies' book - something
> that will start at the most basic level.  The books I've seen out
> there on Amazon.com and other places all seem to be aimed at
> developers, though.  Where can I go to get a basic, basic, BASIC
> tutorial/guidebook for learning PostgreSQL?
>
> Thanks,
>
> Daniel Lerch
> Portland, Oregon
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)


possible to access a Linux box db from a Windows box via a GUI?

From
Daniel Lerch
Date:
It occured to me that I might have an easier time learning PostgreSQL if
I start off with a GUI instead of just command line.

But I access the database over our LAN -- I'm on a Windows 2000 box, and
the psql database is on a Linux box.  I've been accessing it by running
PuTTY.

So, my question is - is there a GUI program I can run off my Windows
2000 box that will allow me to access myt psql database on the Linux
box?  Or do I have no choice but run the GUI on the Linux box?

Thanks,

-d

Re: possible to access a Linux box db from a Windows box via a GUI?

From
Sean Davis
Date:
Look at pgadmin III (http://www.pgadmin.org/pgadmin3/index.php).

Sean

On Oct 12, 2004, at 3:56 PM, Daniel Lerch wrote:

> It occured to me that I might have an easier time learning PostgreSQL
> if I start off with a GUI instead of just command line.
> But I access the database over our LAN -- I'm on a Windows 2000 box,
> and the psql database is on a Linux box.  I've been accessing it by
> running PuTTY.
>
> So, my question is - is there a GUI program I can run off my Windows
> 2000 box that will allow me to access myt psql database on the Linux
> box?  Or do I have no choice but run the GUI on the Linux box?
>
> Thanks,
>
> -d
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>      subscribe-nomail command to majordomo@postgresql.org so that your
>      message can get through to the mailing list cleanly


Re: possible to access a Linux box db from a Windows box

From
Daniel Lerch
Date:
I was looking at that earlier - couldn't tell if it was client-side or
server-side.  Since you're pointing me to it, I'll assume it's
client-side and will try it out.

Also, re your other reply that there are many online SQL tutorials, and
asking where I am in the process:   I guess I'm so new to things that I
didn't realize I should be looking for SQL tutorials, and not postgreSQL
tutorials (I searched for the latter, and they were all too
complicated).   Sounds like I should start with SQL, and then move to
the postgreSQL-specific tutorials later when I'm ready to use more
advanced functions.  I'll give that a shot, and email again if I run
into problems.

Thanks!
-d


Sean Davis wrote:

> Look at pgadmin III (http://www.pgadmin.org/pgadmin3/index.php).
>
> Sean
>
> On Oct 12, 2004, at 3:56 PM, Daniel Lerch wrote:
>
>> It occured to me that I might have an easier time learning PostgreSQL
>> if I start off with a GUI instead of just command line.
>> But I access the database over our LAN -- I'm on a Windows 2000 box,
>> and the psql database is on a Linux box.  I've been accessing it by
>> running PuTTY.
>>
>> So, my question is - is there a GUI program I can run off my Windows
>> 2000 box that will allow me to access myt psql database on the Linux
>> box?  Or do I have no choice but run the GUI on the Linux box?
>>
>> Thanks,
>>
>> -d
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 3: if posting/reading through Usenet, please send an appropriate
>>      subscribe-nomail command to majordomo@postgresql.org so that your
>>      message can get through to the mailing list cleanly
>
>


Re: possible to access a Linux box db from a Windows box

From
Antoine
Date:
On Tue, 12 Oct 2004 13:09:56 -0700, Daniel Lerch
<daniel@mountainmeasurement.com> wrote:
> I was looking at that earlier - couldn't tell if it was client-side or
> server-side.  Since you're pointing me to it, I'll assume it's
> client-side and will try it out.
>
> Also, re your other reply that there are many online SQL tutorials, and
> asking where I am in the process:   I guess I'm so new to things that I
> didn't realize I should be looking for SQL tutorials, and not postgreSQL
> tutorials (I searched for the latter, and they were all too
> complicated).   Sounds like I should start with SQL, and then move to
> the postgreSQL-specific tutorials later when I'm ready to use more
> advanced functions.  I'll give that a shot, and email again if I run
> into problems.
>
> Thanks!
> -d
>
> Sean Davis wrote:
>
> > Look at pgadmin III (http://www.pgadmin.org/pgadmin3/index.php).
> >
> > Sean
> >
> > On Oct 12, 2004, at 3:56 PM, Daniel Lerch wrote:
> >
> >> It occured to me that I might have an easier time learning PostgreSQL
> >> if I start off with a GUI instead of just command line.
> >> But I access the database over our LAN -- I'm on a Windows 2000 box,
> >> and the psql database is on a Linux box.  I've been accessing it by
> >> running PuTTY.
> >>
> >> So, my question is - is there a GUI program I can run off my Windows
> >> 2000 box that will allow me to access myt psql database on the Linux
> >> box?  Or do I have no choice but run the GUI on the Linux box?

Certainly ask your boss to make phppgadmin available for you to access
your pg db from anywhere in the world... it is a php-based script
library (is that the right way to put it?) that runs on the web
server. It kicks everything (including the kitchen sink!;-))! It is
extremely easy to use, and if you are a web kitten then is probably
even more intuitive than access. I have tried to use pgadminIII a bit
but it crashed on me quite a bit - not something I like (I am running
8.0.0beta3 on gentoo).
You really must give this a go, even if it is just at home on
something you set up yourself. Postgres has an excellent windoze
installer and I imagine apache and php also (never used them on doze).
You should be about 10 clicks away, if windoze is as low as I believe
it to be, from a working phppgadmin. If you want I will help you on
your way through (i wouldn't mind installing apache and php on my doze
partition, so can see how it's done, but you'd better have a go at
least first...) to get there.
Cheers
Antoine

--
G System, The Evolving GUniverse - http://www.g-system.at

Re: Postgresql for Dummies?

From
Ron St-Pierre
Date:
Daniel Lerch wrote:

> I need to learn how to work with PostgreSQL for work, but I am
> *completely* unfamiliar with the program, almost completely unfamiliar
> with databases (I've only worked with very basic databases in MS
> Access), and relateively unfamiliar with using non-GUI programs.
>
> In other words, I need a 'Postgresql for Dummies' book - something
> that will start at the most basic level.  The books I've seen out
> there on Amazon.com and other places all seem to be aimed at
> developers, though.  Where can I go to get a basic, basic, BASIC
> tutorial/guidebook for learning PostgreSQL?
>
> Thanks,
>
> Daniel Lerch
> Portland, Oregon
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>
I suggest that you visit a bookstore and actually look at some of the
postgres books out there. I've got Practical Postgres (Worsley & Drake)
and it would probably be suitable for you. While many of these books are
aimed at developers quite a few of them also spell out a lot of the
basics too, so they'll tell you about SQL and how to use postgres. There
are a handful of beginner-intermediate postgresql books out there,
including Bruce Momjian's book Learning PostgreSQL (forgive me if I get
this wrong).

Also, pgAdminIII is a good gui tool for accessing postgres.

Ron



Re: Postgresql for Dummies?

From
Daniel Lerch
Date:
OK, I'll check that book out.

I tried running pgAdminIII, but when I tried to connect to my psql
server I got the error:
"SSL error: wrong version number"

I'll try to figure this out, but one thing it led me to was realizing
that I don't know what verision of psql I'm actually running, and I
don't know how to find out (I noticed that pgAdminIII is for postgreSQL
7.3 and 7.4).  Is there a 'version' command within psql?

Thanks,
-d

> I suggest that you visit a bookstore and actually look at some of the
> postgres books out there. I've got Practical Postgres (Worsley &
> Drake) and it would probably be suitable for you. While many of these
> books are aimed at developers quite a few of them also spell out a lot
> of the basics too, so they'll tell you about SQL and how to use
> postgres. There are a handful of beginner-intermediate postgresql
> books out there, including Bruce Momjian's book Learning PostgreSQL
> (forgive me if I get this wrong).
>
> Also, pgAdminIII is a good gui tool for accessing postgres.
>
> Ron
>
>


Re: Postgresql for Dummies?

From
Ron St-Pierre
Date:
Daniel Lerch wrote:

> OK, I'll check that book out.
>
> I tried running pgAdminIII, but when I tried to connect to my psql
> server I got the error:
> "SSL error: wrong version number"

An SSL error....?

>
> I'll try to figure this out, but one thing it led me to was realizing
> that I don't know what verision of psql I'm actually running, and I
> don't know how to find out (I noticed that pgAdminIII is for
> postgreSQL 7.3 and 7.4).  Is there a 'version' command within psql?

psql --version
     psql (PostgreSQL) 7.4.1
     contains support for command-line editing
or from within psql
select version();
                                 version
     ---------------------------------------------------------------
      PostgreSQL 7.4.1 on i686-pc-linux-gnu, compiled by GCC 2.95.4
     (1 row)

If you've got an earlier version of postgres you can download the
appropriate pgAdmin version (pgAdminII probably), which used to be
available on the website http://pgadmin.postgresql.org/pgadmin2/downloads/

Ron

>
>
> Thanks,
> -d
>
>> I suggest that you visit a bookstore and actually look at some of the
>> postgres books out there. I've got Practical Postgres (Worsley &
>> Drake) and it would probably be suitable for you. While many of these
>> books are aimed at developers quite a few of them also spell out a
>> lot of the basics too, so they'll tell you about SQL and how to use
>> postgres. There are a handful of beginner-intermediate postgresql
>> books out there, including Bruce Momjian's book Learning PostgreSQL
>> (forgive me if I get this wrong).
>>
>> Also, pgAdminIII is a good gui tool for accessing postgres.
>>
>> Ron
>>
>>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
>



Re: Postgresql for Dummies?

From
Bruno Wolff III
Date:
On Tue, Oct 12, 2004 at 11:52:34 -0700,
  Daniel Lerch <daniel@mountainmeasurement.com> wrote:
> I need to learn how to work with PostgreSQL for work, but I am
> *completely* unfamiliar with the program, almost completely unfamiliar
> with databases (I've only worked with very basic databases in MS
> Access), and relateively unfamiliar with using non-GUI programs.
>
> In other words, I need a 'Postgresql for Dummies' book - something that
> will start at the most basic level.  The books I've seen out there on
> Amazon.com and other places all seem to be aimed at developers, though.
> Where can I go to get a basic, basic, BASIC tutorial/guidebook for
> learning PostgreSQL?

You really want to read through the the documentation that comes with
Postgres. It is very good. Even if you don't understand everything at
first, you will at least be aware of what is documented and what kinds
of things Postgres can do, so that if you need something later you will
have an idea where to look.

Configuration problem

From
Alexandre Ricciardi
Date:
Hi all,

I have a problem to connect to my database localy from jdbc,
in postgresql.conf i allow tcp/ip connection,
in pg_hba.conf i have the following lines :
local  all                                                trust
host   all    all        127.0.0.1    255.255.255.255     trust

i don't get where i am wrong in my configuration

Thanks for help

regards

Alexandre

Re: Configuration problem

From
Alexandre Ricciardi
Date:
Alexandre Ricciardi wrote:

> Hi all,
>
> I have a problem to connect to my database localy from jdbc,
> in postgresql.conf i allow tcp/ip connection,
> in pg_hba.conf i have the following lines :
> local  all                                                trust
> host   all    all        127.0.0.1    255.255.255.255     trust
>
> i don't get where i am wrong in my configuration
>
> Thanks for help
>
> regards
>
> Alexandre
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>
>
in postgresql.conf i have "tcpip_socket = true",
but i must start pgsql with "/usr/bin/postmaster -p 5432 -i -D
/var/lib/pgsql/data",
the init.d script does not allow tcp/ip connections perhaps my script is
not good ???



Re: Configuration problem

From
Tom Lane
Date:
Alexandre Ricciardi <alexandre.ricciardi@free.fr> writes:
> in postgresql.conf i have "tcpip_socket = true",
> but i must start pgsql with "/usr/bin/postmaster -p 5432 -i -D
> /var/lib/pgsql/data",
> the init.d script does not allow tcp/ip connections perhaps my script is
> not good ???

You sure you're editing the right copy of postgresql.conf?  Putting that
in the config file should definitely have the same effect as saying -i
on the command line.

One way to make this mistake is if the init script is specifying a
different data directory (-D) than you're doing by hand.

            regards, tom lane

Re: possible to access a Linux box db from a Windows box

From
Andreas
Date:
Hi Daniel,
I'm a novice too but allready for some time   ;)
Sorry for the long rant.


Daniel Lerch wrote:

> It occured to me that I might have an easier time learning PostgreSQL
> if I start off with a GUI instead of just command line.
> But I access the database over our LAN -- I'm on a Windows 2000 box,
> and the psql database is on a Linux box.  I've been accessing it by
> running PuTTY.
>
> So, my question is - is there a GUI program I can run off my Windows
> 2000 box that will allow me to access myt psql database on the Linux
> box?  Or do I have no choice but run the GUI on the Linux box?


First you've got to understand what PostgreSQL does.
It stores data in a sensible way and provides a query inteface. This
interface can't be accessed directly by mere humans.
Compare it to the JET database engine that MSAccess uses. JET is there
in the background and you probaply never heared of it though it is
actually a separate piece of software.

There are 2 type of  actions that you need a client for.
1)   database maintenance
      *  creating/dropping databases, tables, users
      *  making backups
      *  vacuuming the database
2)   data maintenance
      *  editing, deleting records
      *  select and combine records for analysis or export to other programs

The clients are as a rule only good at one type of task.

We need client-tools like psql or PGAdmin that actually know how to talk
in the DB server's language. Next to allways this talking happens over a
LAN or at least over the LAN mechanisms in your local computer as if the
server were on a remote box.
So don't worry about the LAN. You just have to tell Postgres to listen
to the LAN and allow remote connections.
To do this you need to be the DB administrator.

Another possibility is to use ODBC to access Postgres by a standardized
interface. You will then need an ODBC driver for Postgres on your
Windows computer. With it Windows can connect many programs to PG
without them actually knowing what database they are talking to. They
just need to know ODBC.
Here we get MS-Access, Excel, and others back into the game. Access can
link to tables that are stored in PG and you can edit them in Access
with some restrictions.
You can't create or alter tables in a visual way. Though it is possible
with SQL commands that you send the server from withing Access which
shouldn't be your problem at first.
Access is nice if your tables are all created in the way you need them
and you'll just search, edit and delete records.

Someone mentioned phpPGAdmin. It resembles PGAdmin but needs a running
webserver with installed PHP. That'd add a lott more complexity to your
learning, I'd say. phpPGAdmin is surely nice if the PG is on a secure
server that doesn't allow connections from your box but the provider let
a www-server connect where you can put own PHP scripts.

Learning SQL is the way to go and it can be rather easy, too.
Often it is even easier than using a GUI for the managing stuff like
creating tables.
I suppose you used Access to store data in so you probaply know how to
create a table in Access. It's a good number of chosing combo-box values
and checking check-boxes.
In SQL you do:
CREATE TABLE tab1 (
   tab1_id    int4   not null,
   name       varchar(100),
   adress       varchar(200,
   PRIMARY KEY (tab1_id)
);

You could type this directly into psql's command line but that isn't
convenient.
Use your favourite editor and store the command in the file  "tab1.sql".
Then run it on the putty command line through psql.
psql  daniels_database < tab1.sql

If you are allowed to access the servers drive from your computer by a
networkdrive then you could use any windows texteditor you like.

To learn the syntax you can look it up in postres' manual or you can try
to mouseclick what you want in PGAdmin3.  PGAdmin3 shows what SQL
command it used. There you can watch a "professional" at work, but it
does all in the most formalistic way without omitting defaults and other
decorations.

I'd advise to
0)  Get your PG server up and allow LAN connections
1)  start with PGAdmin3 and the PG manual that is included into
PGAdmin3, too.
2)  Rather sooner than later, I'd move to the editor + psql way.
3)  After creating the db tables you can settle back to MS-Access over
ODBC to search and edit data if Access is available in your production
environment.
4)  before you put important stuff into the db learn how to
automatically make regular backups with pg_dump & cron
5)  in a production environment you'll need indices on foreign key
collumns to speed things up.

after you get a grip on that, you can procede to the aspects that lift
PostgreSQL over Access like
*  stored procedures in PG's own language
*  triggers
*  object inheritance

Books on database theory are important in some way but they tend to
demotivate by utter dullness.
It's often like starting to learn how to ride a car by studying how to
mine for iron ore.
Btw. database theory, SQL and managing a PostgreSQL server are 3
different topics that only overlap a bit.

How many rows can postgresql can sustain

From
Kumar S
Date:
Dear group,
 I am wondering how many rows of data can postgresql
efficiently deal with in comparision to Oracle that
can deal with millions and millions of rows (I was
told this fact by my senior).

One of my table has 8876216 rows that look like:
affy_id | exp_id | exp_chip_id | affy_x | affy_y |
affy_mean | affy_stdv | affy_npixels
---------+--------+-------------+--------+--------+-----------+-----------+--------------
 8676216 |        |          58 |    249 |    159 |
 527.5 |      92.3 |           36



   max
---------
 8876216
(1 row)


Is there any upper limit where depending on number of
rows one can say that table (database) is crossing
limits or really bulky.

-Kumar.



_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

Re: How many rows can postgresql can sustain

From
Bruno Wolff III
Date:
Please don't start new threads by replying to old ones. This makes the archives
less usable and will cause some people that might have been able to help you
to miss your message.

On Wed, Oct 13, 2004 at 09:14:11 -0700,
  Kumar S <ps_postgres@yahoo.com> wrote:
> Dear group,
>  I am wondering how many rows of data can postgresql
> efficiently deal with in comparision to Oracle that
> can deal with millions and millions of rows (I was
> told this fact by my senior).

In general Postgres isn't going to have a problem with tables with extremely
large numbers of rows. There may be certain queries that run slower in
postgres than in oracle (in particular certain aggregates) or other databases.

Re: How many rows can postgresql can sustain

From
Oliver Fromme
Date:
Kumar S wrote:
 >  I am wondering how many rows of data can postgresql
 > efficiently deal with in comparision to Oracle that
 > can deal with millions and millions of rows (I was
 > told this fact by my senior).
 >
 > One of my table has 8876216 rows that look like:
 > [...]

Two weeks ago I fed the German telephone book of 2002 into
a PostgreSQL database (for testing purposes).  It was about
36 million rows and 8 GByte of data.  Of course, the import
took a while, but there were no problems at all.  I expect
PostgreSQL to cope with much more data than that.

Best regards
   Oliver

--
Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"Clear perl code is better than unclear awk code; but NOTHING
comes close to unclear perl code"  (taken from comp.lang.awk FAQ)

connecting with pgAdmin II

From
Daniel Lerch
Date:
OK, I figured out my version problems and am now running pgAdmin II on
my Windows XP box to connect to my psql 7.2 database on my Linux box.
Can't quite get it to connect, though; I'm getting this error message:

"No pg_hba.conf entry for host 192.168.2.102, user bbontempo, database
daniel".

(yes, user name and database name exist and are correct, assuming it
wants the username/password for accessing the server itself, and the
name of an existing psql database)

I _think_ this error message means I need to get into the pg_hba.conf
file and create that entry (and I think pg_hba.conf is supposed to be in
the 'pgdata' directory).  Unfortunately, I can find neither pg_hba.conf
(a 'whereis pg_hba.conf' gives me nothing) nor pgdata.

The help files in pgadmin II assume I know my way around Linux commands,
which I don't. So I'm stuck. Help!

=)
-d



Re: connecting with pgAdmin II

From
Tom Lane
Date:
Daniel Lerch <daniel@mountainmeasurement.com> writes:
> I _think_ this error message means I need to get into the pg_hba.conf
> file and create that entry (and I think pg_hba.conf is supposed to be in
> the 'pgdata' directory).  Unfortunately, I can find neither pg_hba.conf
> (a 'whereis pg_hba.conf' gives me nothing) nor pgdata.

Most likely PGDATA is /var/lib/pgsql/data ... to make sure, look at the
init script (probably /etc/init.d/postgresql).  Or you could try
    ps auxww | grep postmaster
and see whether the data directory was specified with a -D switch on the
postmaster's command line.

Don't forget you need to SIGHUP or restart the postmaster after editing
its configuration files.  ("pg_ctl reload" or "service postgresql
reload" usually work for sending SIGHUP conveniently.)

            regards, tom lane

Re: possible to access a Linux box db from a Windows box via a GUI?

From
Mitch Pirtle
Date:
And don't forget to make the proper changes to postgresql.conf (enable
tcp_ip) and pg_hba.conf to accept connections from your PC's ip
address.


On Tue, 12 Oct 2004 16:00:12 -0400, Sean Davis <sdavis2@mail.nih.gov> wrote:
> Look at pgadmin III (http://www.pgadmin.org/pgadmin3/index.php).
>
> Sean
>
>
>
> On Oct 12, 2004, at 3:56 PM, Daniel Lerch wrote:
>
> > It occured to me that I might have an easier time learning PostgreSQL
> > if I start off with a GUI instead of just command line.
> > But I access the database over our LAN -- I'm on a Windows 2000 box,
> > and the psql database is on a Linux box.  I've been accessing it by
> > running PuTTY.
> >
> > So, my question is - is there a GUI program I can run off my Windows
> > 2000 box that will allow me to access myt psql database on the Linux
> > box?  Or do I have no choice but run the GUI on the Linux box?
> >
> > Thanks,
> >
> > -d
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 3: if posting/reading through Usenet, please send an appropriate
> >      subscribe-nomail command to majordomo@postgresql.org so that your
> >      message can get through to the mailing list cleanly
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>

Re: Postgresql for Dummies?

From
Nikki
Date:
In article <416C27F2.50004@mountainmeasurement.com>, Daniel Lerch
<daniel@mountainmeasurement.com> wrote:

> I need to learn how to work with PostgreSQL for work, but I am
> *completely* unfamiliar with the program, almost completely unfamiliar
> with databases (I've only worked with very basic databases in MS
> Access), and relateively unfamiliar with using non-GUI programs.
>
> In other words, I need a 'Postgresql for Dummies' book - something that
> will start at the most basic level.  The books I've seen out there on
> Amazon.com and other places all seem to be aimed at developers, though.
> Where can I go to get a basic, basic, BASIC tutorial/guidebook for
> learning PostgreSQL?
>
> Thanks,
>
> Daniel Lerch
> Portland, Oregon
>
Hi Daniel

I'm a recent starter, and have the O'Reilly 'Practical Postgresql'.
However, I must say I found that a daunting task to start with. So my
advice would be:  Get the book, beause you're going to need it, but
don't start with it; it'll come into its own when you're using it as a
reference. So first, check the postgresql site documentation, and look
out for tutorials, AND go googling for other postgresql tutorials. That
go me started, because it is EXTREMELY easy to get started - it's just
that the books don't make it look easy!  The complexity is in getting
the data out and 'operating' on it!  It's really easy to set up a
database and get data into it.

I'll say that I am reasonably familiar with command line work, as a
Linux user. If you need that, it may be a good idea to get used to that
without tyring to learn postgresql at the same time.

If you were a Dummy, you wouldn't be choosing to use postgresql!

Good Luck, and Holler again if you need good solid amateur advice in
plain English.

Nikki

Re: possible to access a Linux box db from a Windows box

From
"Hari Bhanujan"
Date:
pgAdmin to connect to Postgresql (client install on Windows).

Start postgresql with -I option.

Hari

-----Original Message-----
From: pgsql-novice-owner@postgresql.org
[mailto:pgsql-novice-owner@postgresql.org] On Behalf Of Andreas
Sent: Wednesday, October 13, 2004 9:37 AM
To: Daniel Lerch
Cc: pgsql-novice@postgresql.org
Subject: Re: [NOVICE] possible to access a Linux box db from a Windows
box

Hi Daniel,
I'm a novice too but allready for some time   ;)
Sorry for the long rant.


Daniel Lerch wrote:

> It occured to me that I might have an easier time learning PostgreSQL
> if I start off with a GUI instead of just command line.
> But I access the database over our LAN -- I'm on a Windows 2000 box,
> and the psql database is on a Linux box.  I've been accessing it by
> running PuTTY.
>
> So, my question is - is there a GUI program I can run off my Windows
> 2000 box that will allow me to access myt psql database on the Linux
> box?  Or do I have no choice but run the GUI on the Linux box?


First you've got to understand what PostgreSQL does.
It stores data in a sensible way and provides a query inteface. This
interface can't be accessed directly by mere humans.
Compare it to the JET database engine that MSAccess uses. JET is there
in the background and you probaply never heared of it though it is
actually a separate piece of software.

There are 2 type of  actions that you need a client for.
1)   database maintenance
      *  creating/dropping databases, tables, users
      *  making backups
      *  vacuuming the database
2)   data maintenance
      *  editing, deleting records
      *  select and combine records for analysis or export to other
programs

The clients are as a rule only good at one type of task.

We need client-tools like psql or PGAdmin that actually know how to talk

in the DB server's language. Next to allways this talking happens over a

LAN or at least over the LAN mechanisms in your local computer as if the

server were on a remote box.
So don't worry about the LAN. You just have to tell Postgres to listen
to the LAN and allow remote connections.
To do this you need to be the DB administrator.

Another possibility is to use ODBC to access Postgres by a standardized
interface. You will then need an ODBC driver for Postgres on your
Windows computer. With it Windows can connect many programs to PG
without them actually knowing what database they are talking to. They
just need to know ODBC.
Here we get MS-Access, Excel, and others back into the game. Access can
link to tables that are stored in PG and you can edit them in Access
with some restrictions.
You can't create or alter tables in a visual way. Though it is possible
with SQL commands that you send the server from withing Access which
shouldn't be your problem at first.
Access is nice if your tables are all created in the way you need them
and you'll just search, edit and delete records.

Someone mentioned phpPGAdmin. It resembles PGAdmin but needs a running
webserver with installed PHP. That'd add a lott more complexity to your
learning, I'd say. phpPGAdmin is surely nice if the PG is on a secure
server that doesn't allow connections from your box but the provider let

a www-server connect where you can put own PHP scripts.

Learning SQL is the way to go and it can be rather easy, too.
Often it is even easier than using a GUI for the managing stuff like
creating tables.
I suppose you used Access to store data in so you probaply know how to
create a table in Access. It's a good number of chosing combo-box values

and checking check-boxes.
In SQL you do:
CREATE TABLE tab1 (
   tab1_id    int4   not null,
   name       varchar(100),
   adress       varchar(200,
   PRIMARY KEY (tab1_id)
);

You could type this directly into psql's command line but that isn't
convenient.
Use your favourite editor and store the command in the file  "tab1.sql".
Then run it on the putty command line through psql.
psql  daniels_database < tab1.sql

If you are allowed to access the servers drive from your computer by a
networkdrive then you could use any windows texteditor you like.

To learn the syntax you can look it up in postres' manual or you can try

to mouseclick what you want in PGAdmin3.  PGAdmin3 shows what SQL
command it used. There you can watch a "professional" at work, but it
does all in the most formalistic way without omitting defaults and other

decorations.

I'd advise to
0)  Get your PG server up and allow LAN connections
1)  start with PGAdmin3 and the PG manual that is included into
PGAdmin3, too.
2)  Rather sooner than later, I'd move to the editor + psql way.
3)  After creating the db tables you can settle back to MS-Access over
ODBC to search and edit data if Access is available in your production
environment.
4)  before you put important stuff into the db learn how to
automatically make regular backups with pg_dump & cron
5)  in a production environment you'll need indices on foreign key
collumns to speed things up.

after you get a grip on that, you can procede to the aspects that lift
PostgreSQL over Access like
*  stored procedures in PG's own language
*  triggers
*  object inheritance

Books on database theory are important in some way but they tend to
demotivate by utter dullness.
It's often like starting to learn how to ride a car by studying how to
mine for iron ore.
Btw. database theory, SQL and managing a PostgreSQL server are 3
different topics that only overlap a bit.

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings


Re: connecting with pgAdmin II

From
"Hari Bhanujan"
Date:
What are your results for pg_ctl start and initdb  ?

On your linux box check for the following -
Postmaster.pid (Do a locate first)

Make sure that you have the postgresql user into the shell script for
the user that you are using to log into the userbox.

Eg :

/home/linuxuser $ vi .bash_profile

postgrehost = IP address
postgreuser = username
postgrepass = passwd
postgreport = 5422 (If you are using default)
export postgrehost postgreuser postgrepass postgreport

login and logout for the shell script to work.

Hari



-----Original Message-----
From: pgsql-novice-owner@postgresql.org
[mailto:pgsql-novice-owner@postgresql.org] On Behalf Of Daniel Lerch
Sent: Wednesday, October 13, 2004 12:50 PM
To: pgsql-novice
Subject: [NOVICE] connecting with pgAdmin II

OK, I figured out my version problems and am now running pgAdmin II on
my Windows XP box to connect to my psql 7.2 database on my Linux box.
Can't quite get it to connect, though; I'm getting this error message:

"No pg_hba.conf entry for host 192.168.2.102, user bbontempo, database
daniel".

(yes, user name and database name exist and are correct, assuming it
wants the username/password for accessing the server itself, and the
name of an existing psql database)

I _think_ this error message means I need to get into the pg_hba.conf
file and create that entry (and I think pg_hba.conf is supposed to be in

the 'pgdata' directory).  Unfortunately, I can find neither pg_hba.conf
(a 'whereis pg_hba.conf' gives me nothing) nor pgdata.

The help files in pgadmin II assume I know my way around Linux commands,

which I don't. So I'm stuck. Help!

=)
-d



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


Re: Postgresql for Dummies?

From
"Hari Bhanujan"
Date:
One novice to another -

Start with the site postgresql.org.

There is a book called "Postgresql" by Korry and Susan Douglas.

That should help you get started with 7.x.x version of PostgreSql.

Hari

-----Original Message-----
From: pgsql-novice-owner@postgresql.org
[mailto:pgsql-novice-owner@postgresql.org] On Behalf Of Nikki
Sent: Wednesday, October 13, 2004 9:27 AM
To: pgsql-novice@postgresql.org
Subject: Re: [NOVICE] Postgresql for Dummies?

In article <416C27F2.50004@mountainmeasurement.com>, Daniel Lerch
<daniel@mountainmeasurement.com> wrote:

> I need to learn how to work with PostgreSQL for work, but I am
> *completely* unfamiliar with the program, almost completely unfamiliar

> with databases (I've only worked with very basic databases in MS
> Access), and relateively unfamiliar with using non-GUI programs.
>
> In other words, I need a 'Postgresql for Dummies' book - something
that
> will start at the most basic level.  The books I've seen out there on
> Amazon.com and other places all seem to be aimed at developers,
though.
> Where can I go to get a basic, basic, BASIC tutorial/guidebook for
> learning PostgreSQL?
>
> Thanks,
>
> Daniel Lerch
> Portland, Oregon
>
Hi Daniel

I'm a recent starter, and have the O'Reilly 'Practical Postgresql'.
However, I must say I found that a daunting task to start with. So my
advice would be:  Get the book, beause you're going to need it, but
don't start with it; it'll come into its own when you're using it as a
reference. So first, check the postgresql site documentation, and look
out for tutorials, AND go googling for other postgresql tutorials. That
go me started, because it is EXTREMELY easy to get started - it's just
that the books don't make it look easy!  The complexity is in getting
the data out and 'operating' on it!  It's really easy to set up a
database and get data into it.

I'll say that I am reasonably familiar with command line work, as a
Linux user. If you need that, it may be a good idea to get used to that
without tyring to learn postgresql at the same time.

If you were a Dummy, you wouldn't be choosing to use postgresql!

Good Luck, and Holler again if you need good solid amateur advice in
plain English.

Nikki

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if
your
      joining column's datatypes do not match