Speed up sorting in this query
I’m trying to optimize the following plan and noticed that PostgreSQL spends a lot of time (relatively speaking) on sorting before the merge joins. Is there a way (using indexes, cluster the table,...
View ArticleUseful guide & FAQ for Application+SQL
Of course when you are making your first application for fun it doesn’t matter that much how you deal with things. But when you need everything to be up to the current standards you don’t always know...
View ArticlePostgreSQL: Trigger for updating view doesn't work
I’m trying to make the trigger for updating a view work. If I’m doing and INSERT it works! But when I’m trying to do an UPDATE it just doesn’t run. CREATE OR REPLACE FUNCTION test_trigger_function()...
View Articleassign selected columns to a variable
Select sum(column_a) as a, sum(column_b) as b round(a / b) From table Group by column In the example above I am summing two column, and I would like to use those 2 results in calculating another...
View ArticleSUM() the result of a stored procedure
I use the Pl/Proxy extension in order to shard a table. It works like a charm, except for this : I have a stored procedure which runs on 4 shards. It looks like this : CREATE OR REPLACE FUNCTION...
View ArticleError on registering geodabase with ArcGIS Server 10.2
We’re in the middle of a migrating process. We’ve imported a geodatabase on a new Linux machine and we’re trying to publish some map services to this new ArcGIS Server (that resides on the same...
View ArticleHow many Maximum Number of database can be created in single instance of...
How many Maximum Number of database can be created in single instance of PostgreSQL 9.x?
View Articlerepmgr: Can I replicate databases from two different masters to a third slave?
If I have a master node 1 (with database A) and a master node 2 (with database B) can I use repmgr and have both A and B replicated to a hot standby node 3 ? [ EDIT: They would all be running Postgres...
View ArticleCan you force pgpool to require SSL connections?
Can you force pgpool to drop non-ssl connections? I know you can with postgresql (Force PostgreSQL clients to use SSL?), but dropping that same syntax (hostssl instead of host) results in a...
View Articleaccessing fields of returned record object
I need to use a function which exists on another database and was able to figure out how to access it via dblink. The function returns the name of an encryption algorithm and the key used for it, as...
View ArticleHow to start my 9.2 data directory using an 8.4 server?
I have an old version of postgres (8.4.13) that doesn’t run for various reasons. I plan to move the database files in there to a new install of postgres 9.3. How would I go about doing this? For one I...
View ArticleUsing the correct postgres server
I’m not sure what happened but I logged in on friday and did psql -d name to access a db that was perfectly running just fine. Then I log in this monday morning and try to access the same database with...
View ArticleAdding a PostgreSQL database to settings.php causes update.php to fail with...
In order to import some data from a PostgreSQL database to Drupal I added another entry to the databases array in settings.php. After updating the modules and executing update.php Drupal returns this...
View ArticleCalculate value differences of rows before and after bounded by multiple...
Supposed I have a user travelling table like this: id | start_time | end_time | location | ----+--------------+------------+------------+ 1 | 1 | 2 | Loc_A | 1 | 3 | 4 | Loc_B | 1 | 5 | 6 | Loc_A | 1 |...
View ArticleIs there a way I can use currval() without selecting it more than once?
I want to be able to use the current value of an auto ID by giving it some kind of name and just referring to it (instead of calling SELECT for each record): Requests table has a serial column named...
View ArticleDoes PostgreSQL write first to WAL and then to data files?
This is regarding the synchronous_commit in Postgres. The synchronous_commit documentation says: Specifies whether transaction commit will wait for WAL records to be written to disk before the command...
View ArticleMeaning of query in pgbouncer.log
I could not find any documentation about pgbouncer log, I’m assuming it has the same meaning as the SHOW STATS ? req/s – number of requests since last stat period in b/s – Bytes per sec received ? out...
View ArticleHow to render tiles from kml file
I’m trying to render tiles out of a KML file. Normally, I’d render tiles out of an planet.osm extract. For example, I’d select a tag using osmosis and then process it with osm2pgsql. Then I’d generate...
View ArticleInstalled PostGIS extension not listed for database
I have a PostgreSQL database with the PostGIS extension enabled. I know that this extension is enabled, since I am using PostGIS functions, and I can actually see the PostGIS functions. However,...
View ArticleMissing the pg_ctl package in Postgres 9.3 installation
I have installed postgresql 9.3 on ubuntu 14.04 using “apt-get install postgresql”. Everything was going well until I discovered that I do not have access to the “pg_ctl” commands. Installing the...
View Article