Below you will find pages that utilize the taxonomy term “Postgres”
Install psycopg2 (PostgreSQL adapter for Python) on OSX
I was playing with Django with Postgres backend, and I had little difficulty installing “psycopg2” the Python DB adapter for Postgres on my Mac OSX.
I’ve installed Postgres using Postgres.app for OSX which is straight forward and standard Mac app.
But when I tried installing “psycopg2” using “pip” (the python package manager) I got an error:
$ pip install psycopg2
:
Error: pg_config executable not found.
:
I just searched for “pg_config” in my system:
Accelerating Postgres connections with PgBouncer
PgBouncer is a lightweight connection pooler for PostgreSQL, connection pooling makes Postgres connection much faster, which is important in Web applications.
Login to PostgreSQL without typing a Password
If you to connect to PostgreSQL without typing a password, you can do it by having your password in the file “.pgpass”.
PostgreSQL: New Project Setup
For each new project that need PostgreSQL you should create its own user and its own DB, the following are the steps need for that.
Installation
$ sudo aptitude install postgresql
$ sudo aptitude install python-psycopg2 # For Django access
Require a Password
$ sudo vi /etc/postgresql/9.1/main/pg_hba.conf
:
#local all all peer
local all all md5
:
$ sudo service postgresql restart
Create Postgres User
$ sudo -u postgres createuser -P my_user
Enter password for new role:
Enter it again:
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
Create DB
$ sudo -u postgres createdb my_db -O my_user
Test It
$ psql -U my_user my_db
After login you issue any SQL statement, you should also try the following commands:
Django backend benchmark
I create small Django app and tried to benchmark it with different backends, here is the result:
Backend | Req/Sec |
---|---|
PostgreSQL | 68.41 |
PostgreSQL+pgpool | 116.12 |
MySQL | 127.61 |
PostgreSQL on Ubuntu from scratch
My notes on installing and configuring PostgreSQL on Ubuntu Linux.
PostgreSQL is used by many large web sites and services, including Skype, Reddit, Instagram, “.org” registerer, check longer list here Prominent Users
Best of all it isn’t owned by anyone, not Oracle nor anyone else!
PostgreSQL included in Solaris 10
Sun microsystem will include PostgreSQL open source database with every copy of Solaris 10, with 24/7 support also 🙂
PostgreSQL and PHP (on Windows)
After installing PostgreSQL (15 minutes job), and playing with pgAdminIII, I decided to try it with PHP.
PostgreSQL on windows
Last weekend I decided to try PostgreSQL on Windows, I download PostgreSQL 8.1 installation file from PostgreSQL website, it was 22Mg zip file.
I also downloaded the 12 Mg manual, which contains everything about Postgres.
The installation is straight forward, simple wizard with some clicks and everything is installed and Postgres is running.
Postgres comes with two clients:
- psql: CLI (command line) client.
- pgAdminIII: graphical client.
pgAdmin (see the screen shot) looks amazing and gives you access to all parts of the database, and you can connect to multiple databases. I got intimidated at first when I saw all the options in pgAdminIII but after looking carefully at them it isn’t that scary 🙂