Install Postgresql 15 on Fedora 38/37/36, CentOS/RHEL/Rocky Linux 9/8.5

This is guide, howto install PostgreSQL 15/14/13/12 database server on Fedora 38/37/36, CentOS/Red Hat (RHEL)/Rocky Linux 9/8.5. This guide uses PostgreSQL own YUM repos, which are always up-to-date and stable releases are available instantly. You can use this guide to install any Postgresql versions, like 15, 14, 13, 12 etc. Check video guide howto install PostgreSQL 14/13/12 on Fedora 35/34 using PostgreSQL’s own dnf repo: Subscribe and follow: Follow @inttf Check video guide howto install PostgreSQL 14/13/12 on Rocky Linux 8.
Read more →

Install Apache/PHP 7.2.12 on Fedora 29/28, CentOS/RHEL 7.5/6.10

This guide shows howto install Apache HTTP Server (httpd) with PHP 7.2.12 and following modules on Fedora 29/28/27, CentOS 7.5/6.10 and Red Hat (RHEL) 7.5/6.10 systems. OPcache (php-opcache) – The Zend OPcache provides faster PHP execution through opcode caching and optimization. APCu (php-pecl-apcu) – APCu userland caching CLI (php-cli) – Command-line interface for PHP PEAR (php-pear) – PHP Extension and Application Repository framework PDO (php-pdo) – A database access abstraction module for PHP applications MySQL (php-mysqlnd) – A module for PHP applications that use MySQL databases PostgreSQL (php-pgsql) – A PostgreSQL database module for PHP MongoDB (php-pecl-mongodb) – PHP MongoDB database driver Redis (php-pecl-redis) – Extension for communicating with the Redis key-value store Memcache (php-pecl-memcache) – Extension to work with the Memcached caching daemon Memcached (php-pecl-memcached) – Extension to work with the Memcached caching daemon GD (php-gd) – A module for PHP applications for using the gd graphics library XML (php-xml) – A module for PHP applications which use XML MBString (php-mbstring) – A module for PHP applications which need multi-byte string handling MCrypt (php-mcrypt) – Standard PHP module provides mcrypt library support 1.
Read more →

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 random() function, which returns random value between 0-1. Following example selects 5 random values using generate_series() function: SELECT random() FROM generate_series(1,5); random ——————- 0.595817462075502 0.350072300527245 0.989073566626757 0.700899163261056 0.940509075298905 (5 rows) Next thing to todo is convert random function values to real float values in a range 1-100: SELECT random() * 99 + 1 FROM generate_series(1,5); ?
Read more →

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 delay execution of the server process. pg_sleep makes the current session’s process sleep until seconds seconds have elapsed. Seconds is a value of type double precision, so fractional-second delays can be specified.
Read more →

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

This is quick guide howto install PostgreSQL 8.4 (current stable 8.4.7) database server on CentOS, Fedora and Red Hat. Fedora 14, 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 like to use Postgres own repositories, because the latest version of PostgreSQL may be quickly and easily installed. The following commands run as root and postgres user, so “su -” or “sudo -i” first.
Read more →

nginx, PHP 5.3 and FastCGI on CentOS 5.5, Fedora 13, Red Hat RHEL 5.5/6

This is guide howto install nginx, PHP 5.3 and FastCGI webserver with MySQL and/or PostgreSQL and Memcache support on Fedora 12 and Fedora 13, CentOS 5.5, Red Hat (RHEL) 5.5/6. nginx (engine x) is a robust, small and high performance http server, reverse proxy server and also mail proxy server.

  1. Add and enable needed repositories: Updated 19.3.2010 Use following repositories to install nginx 0.8.xx version (currently 0.8.36 version) rpm -Uvh http://download.
Read more →

PostgreSQL: Partitioned Table vs Non Partitioned Table (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 part ‘Howto create PostgreSQL table partitioning (Part 1)‘. This is comparision between partitioned and non partitioned PostgreSQL tables. The same tests were carried out with and without indices, because using the indices, it is no longer very meaningful example on table, which has one billion rows of data (if the table is not partitioned).
Read more →

PHP Script to Generate 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 tables, indexes, trigger function and parent table trigger. This example script can make PostgreSQL table partitioning with using Date ranges. Script can be configured with following configuration section:
Read more →

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 or list partitioning. Range partitioning can be done for example by ID ranges (like 0-100 000, 100 001-200 000, 200 001-300 000…) or Date ranges (like 2009-11-01 – 2009-11-30, 2009-12-01 – 2009-12-31…).
Read more →

Partitioning PostgreSQL Tables - Handle Millions of Rows Efficiently

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 improved dramatically Reducing index size and making it more likely that the heavily-used parts of the indexes fit in memory Rarely used data can be moved to slower and cheaper storage media This topic is divided into three parts, which are as follows and published in the following order: Part 1.
Read more →

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.

  1. Tuning psqlrc 1.1 Set all null fields to NULL: \pset null 'NULL' After this, the query results look like this: select 'test' as test_text, null as test_null; test_text | test_null ———–+———– test | NULL (1 row) 1.2 Set the command history file names for each host and database: \set HISTFILE ~/.
Read more →
Subscribe and follow: