SQL Archive

  • fedora-centos-red-hat-logos

    Install Apache (httpd) and PHP 5.3.3 on Fedora 13, CentOS/RHEL 5.5/6

    This guide shows howto install Apache HTTP Server (httpd) with PHP 5.3.3 and following modules: PEAR PDO MySQL PostgreSQL Memcache GD XML MBString MCrypt on Fedora 13/12/11/10/9/8/7/6, CentOS 5.4/5.5 and Red Hat (RHEL) 5.4/5.5/6 systems. Install Apache HTTP Server (httpd) and PHP 5.3.3 1. Change...

    Full Story

  • postgresql-logo

    PostgreSQL: Select a Random Number in a Range (Between Two Numbers)

    This is quick tip howto select a random number in a range. Example random number between 1-100 (>= 1 and < 100). This is actually very easy job with PostgreSQL own random() function, which returns random value between 0-1. Following example selects 5 random values...

    Full Story

  • postgresql-logo

    PostgreSQL Sleep Function pg_sleep – Postgres Delay Execution

    One day, I was looking for PostgreSQL database function, which could delay the execution of queries. At first I thought that I will do one myself, because I do not remember ever seen this kind function. But then I found pg_sleep Postgres function which directly...

    Full Story

  • postgresql-logo

    Howto Install PostgreSQL 8.4 Database Server on CentOS, Fedora, Red Hat

    This is quick guide howto install PostgreSQL 8.4 (current stable 8.4.4) database server on CentOS, Fedora and Red Hat. Fedora 12, Fedora 13, CentOS 5.5 and Red Hat (RHEL) 5.5 has PostgreSQL 8.4 database server as default so extra repositories is not needed. Personally, I...

    Full Story

  • postgresql-logo

    Performance testing between partitioned and non partitioned PostgreSQL tables (Part 3)

    This article compares the speed and performance of queries between partitioned and non partitioned PostgreSQL tables. However, it is important to remember that the PostgreSQL tables partitioning has also another benefits, than the better performance on queries. More information about other benefits from the first...

    Full Story

  • postgresql-logo

    PHP script to generate SQL commands for PostgreSQL table partitioning (Part 2)

    As Part 1 (Howto create PostgreSQL table partitioning) shows, making of PostgreSQL partitioning needs a lot of SQL commands. So this Part 2 explains how SQL commands for PostgreSQL partitioning can be made with a simple PHP script. This example script make SQL for child...

    Full Story

  • postgresql-logo

    Howto create PostgreSQL table partitioning (Part 1)

    PostgreSQL supports partitioning via table inheritance. So the partitioning is made in such a way that every child table inherits single parent table. Parent table is empty and it exists just to describe the whole data set. PostgreSQL partitioning can be implemented in range partitioning...

    Full Story

  • postgresql-logo

    Partitioning large PostgreSQL tables and handle millions of rows efficiently and quickly

    PostgreSQL table partitioning means splitting one large database table into smaller logical pieces. PostgreSQL table partitioning will be worthwhile only when a table would be very large. Here are a few benefits of what can be achieved with partitioning: Large tables query performance can be...

    Full Story

  • postgresql-logo

    Postgresql (psql) .psqlrc tips and tricks

    Psql is a good tool for the PostgreSQL database management and use. Psql client functioning can easily be improved by adding a few lines ~/.psqlrc file. Set all null fields to NULL: \pset null 'NULL' After this, the query results look like this: select 'test'...

    Full Story