postgres


in-database analytics are just wrapper UDF's over e.g. NLTK, or alchemy. They can be single row or aggregate udf's.
in about 10-20 lines of code the maden paper udf's were developed.
They didn't actually develop the methods, just wrappers and maybe just some modifications to make them work.
when he(kun) says I don't know, it didn't finish, it was actually alchemy doing the job.



$ sudo apt-get install postgresql postgresql-contrib
$ sudo apt-get install postgresql-client
$ sudo apt-get install pgadmin3

$ sudo -u postgres psql postgres # login to postgres using postgres user name
postgres=# \password postgres # change password of postgres user to nona

Type Control+D to exit the posgreSQL prompt.


$ sudo -u postgres createdb mydb    # create a db

To get an idea of what PostgreSQL can do, you may start by firing up a graphical client. In a terminal type :

 $ pgadmin3
You will be presented with the pgAdmin III interface. Click on the "Add a connection to a server" button (top left). In the new dialog, enter the address 127.0.0.1 (Local host is default, so it can be left out.), a description of the server, the default database ("mydb" in the example above), your username ("postgres") and your password.


$ psql -h 127.0.0.1 mydb postgres         # connect to mydb as postgres user







http://www.tutorialspoint.com/postgresql/postgresql_drop_database.htm

$ sudo su postgres
$ psql
postres=#  \list
                                      List of databases
      Name      |     Owner      | Encoding |  Collation  |    Ctype    |   Access privileges  
----------------+----------------+----------+-------------+-------------+-----------------------
 DualInstance   | dualinstance   | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 SingleInstance | singleinstance | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 postgres       | postgres       | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 template0      | postgres       | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
                                                                        : postgres=CTc/postgres
 template1      | postgres       | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
                                                                        : postgres=CTc/postgres
(5 rows)


postgres=# \c SingleInstance
psql (8.4.18)
You are now connected to database "SingleInstance".

SingleInstance=# \dt
                  List of relations
Schema |        Name        | Type  |     Owner     
--------+--------------------+-------+----------------
 public | array                    | table | singleinstance
 public | array_attribute       | table | singleinstance
 public | array_dimension    | table | singleinstance
 public | array_partition       | table | singleinstance
 public | array_version        | table | singleinstance
 public | array_version_lock | table | singleinstance
 public | cluster                  | table | singleinstance
 public | instance                | table | singleinstance
 public | libraries                 | table | singleinstance
(9 rows)


SingleInstance-# \d array
                                     Table "public.array"
       Column        |       Type        |                     Modifiers                     
---------------------+-------------------+----------------------------------------------------
 id                            | bigint                  | not null default nextval('array_id_seq'::regclass)
 name                      | character varying |
 partitioning_schema | integer                |
 flags                       | integer                |
 comment                | character varying |
Indexes:
    "array_pkey" PRIMARY KEY, btree (id)
    "array_name_key" UNIQUE, btree (name)
Referenced by:
    TABLE "array_attribute" CONSTRAINT "array_attribute_array_id_fkey" FOREIGN KEY (array_id) REFERENCES "array"(id) ON DELETE CASCADE
    TABLE "array_dimension" CONSTRAINT "array_dimension_array_id_fkey" FOREIGN KEY (array_id) REFERENCES "array"(id) ON DELETE CASCADE
    TABLE "array_partition" CONSTRAINT "array_partition_array_id_fkey" FOREIGN KEY (array_id) REFERENCES "array"(id) ON DELETE CASCADE
    TABLE "array_version" CONSTRAINT "array_version_array_id_fkey" FOREIGN KEY (array_id) REFERENCES "array"(id) ON DELETE CASCADE
    TABLE "array_version" CONSTRAINT "array_version_version_array_id_fkey" FOREIGN KEY (version_array_id) REFERENCES "array"(id) ON DELETE CASCADE

SingleInstance=# select * from public.array;                                               DONT FORGET SEMI-COLON!!!!!!
 id  |      name      | partitioning_schema | flags | comment
-----+----------------+---------------------+-------+---------
 265 | subimg         |                   1 |     0 |
 266 | subimg@1       |                   1 |     0 |
 211 | hsi_img_flat   |                   1 |     0 |
 212 | hsi_img_flat@1 |                   1 |     0 |
 213 | hsi_img        |                   1 |     0 |
(5 rows)


Type \q and then press ENTER to quit psql.
























Comments