Hi, I just wanted to share how I moved Postgresql cluster from hard disk to an empty SSD disk and also created a SWAP file inside it.

1. Moving Postgresql cluster from hard disk to SSD disk

# stop postgres server
sudo service postgresql stop

# create new filesystem in empty hard drive
sudo mkfs.ext4 /dev/sdb

# mount it
mkdir /tmp/pg
sudo mount /dev/sdb /tmp/pg/

# copy the entire postgres home dir content
sudo cp -a /var/lib/postgresql/. /tmp/pg

# mount it to the correct directory
sudo umount /tmp/pg
sudo mount /dev/sdb /var/lib/postgresql/

# see if it is mounted
mount | grep postgres

# add the mount point to fstab
echo "/dev/sdb /var/lib/postgresql ext4 rw 0 0" | sudo tee -a /etc/fstab

# when database is in use, observe that the correct disk is being used
watch -d grep xvd /proc/diskstats

2. Creating SWAP file

sudo mkdir -v /var/lib/postgresql/swap
cd /var/lib/postgresql/swap
sudo dd if=/dev/zero of=swapfile bs=1K count=20971520
sudo mkswap /var/lib/postgresql/swap/swapfile

sudo chmod 600 swapfile
sudo swapon swapfile

sudo echo "/var/lib/postgresql/swap/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab

According to https://www.postgresql.org/docs/current/static/when-can-parallel-query-be-used.html,
"Even when it is in general possible for parallel query plans to be generated, the planner will not generate them for a given query if any of the following are true:

The query writes any data or locks any database rows. If a query contains a data-modifying operation either at the top level or within a CTE, no parallel plans for that query will be generated. This is a limitation of the current implementation which could be lifted in a future release."

Indeed, when I try to insert result of a parallel SELECT query into a table (either by SELECT.. INTO either by WITH..SELECT..INTO, the query is not executed as parallel query.

My question is: Is there any way to trick the Postgresql so that a SELECT query is executed as parallel query and then its result inserted into a table?


I need Cartesian product of the two tables MINUS combinations where two tables have same value in a field. Please, note NOT EQUAL condition in where clause.

SELECT
table1.field1,
table1.field2,
table2.field3,
table2.field4
FROM
table1, table2
WHERE
table1.field1 <> table2.field3;

Now, let's suppose that table1 and table2 have a million records each and that fields are indexed. What is the most efficient way to retrieve the resultset in reasonable time? Is there a better way to write this query?

Post has attachment

Post has attachment
Your First Application using MySQL and PHP http://bit.ly/2pWUlQH

Post has attachment
Ein Blick auf Andl

Die neue Datensprache Andl ist ein großartiges neues Open Source-Projekt, das Sie kennenlernen sollten.
Erfahren Sie jetzt alles Wissenswerte über Andl!

HI everyone. Can anyone explain why pgModeler presents field types that do not exist in Postgres, like "tinterval"? Thanks.

Post has attachment
Hi +Raphael Araújo​,
for some time now there is an idea going around in my head. Would it be possible to have database changes done with the PostgreSQL Database Modeler saved and read with Switch (http://sqitch.org/)?
That would give the Modeler an interface to work with more than just one developer on a database model. In addition one gets the ability to deploy database changes easily.

Let me know, what you think about it. And thanks a lot for your work on the PostgreSQL Database Modeler.

amigos tengo una consulta
me esta ocurriendo este problema , aca la EÑE (
Ñ ), va despues de la ENE ( N ) y la DOBLE ELE ( LL ), va despues de la (L ).
Pero cuando intento ordenar los apellidos la EÑE, se ubica antes que la letra ' A ', y la doble ele " LL ", tampoco se ubica correctamente despues de la ELE " L ".


Si tienen un ejemplo de los comandos mucho mejor, soy nuevo en este mundo
del Postgres.

** pgModeler 0.8.1-alpha is out! **

This is the first alpha release for the upcoming patch version 0.8.1. It brings some small fixes for bugs reported in the 0.8.0 including a fix for Windows version which had some problems related to configuration files not being correctly copied as well to the "DLL entry point not found" error. Additional improvements were done here and there to make the tool even better. Refer to CHANGELOG.md to the complete list of news/changes/fixes.

I'm planning to make the development timeline for 0.8.1 shorter than 0.8.0. Also, we'll have two patch releases (0.8.1 and 0.8.2) as usual before start to work on the major release 0.9.0 (no release date yet).

Well, that's it!
Don't forget to submit any bugs at GitHub!

Changelog:
https://github.com/…/pgmodel…/blob/v0.8.1-alpha/CHANGELOG.md

Binaries:
http://www.pgmodeler.com.br

Source code:
https://github.com/pgmodeler/pgmodeler/releases
Wait while more posts are being loaded