Quantcast
Channel: Question and Answer » postgresql
Browsing all 1138 articles
Browse latest View live

Plotting points on a map, the json objects retrieved from a database; using...

I am using an OSM dataset using which I am plotting those points on a map (google maps API). I am plotting these points using webgl shader code (see:  http://psousa.net/demos/webgl/) The above link by...

View Article


Clarification on UNION ALL of JSONB_EACH result

This function used to merge 2 JSONB and delete certain key when the value is null, refer to this question. CREATE FUNCTION jsonb_merge(JSONB, JSONB) RETURNS JSONB AS $$ WITH json_union AS ( SELECT *...

View Article


anonymous blocks inside a transaction [closed]

I have the following script: DROP TABLE IF EXISTS a; CREATE TABLE a( val VARCHAR NOT NULL ); DO $do$ BEGIN INSERT INTO a(val) VALUES('a1'); INSERT INTO a(val) VALUES('a2'); END; $do$ When I place it in...

View Article

Tool to find CPU utilization for a particular query in Postgres

I just want to know is there any free tool to identify CPU utilization for a particular query in PostgreSQL.

View Article

Where do you find the citext module in postgres 9.3 on ubuntu 14.04?

So I’m trying to use citext, but it appears to be MIA from ubuntu 14.04 postgres install. Where can you find this mythical beast called citext for postgresql 9.3? $ manage dbshell Password for user...

View Article


how can an additional natural join with the same table twice *reduce* the row...

This is real results from my database. I spend some time trying to reproduce this behavior with an SSCCE but failed. How is the last of the below results possible? SELECT COUNT(*) FROM rr.resource a...

View Article

Postgres Nested WHEN Aggregate Function

In PostgreSQL (version 9.4) I am trying to construct a query to determine in various tranches how many times various numbers appear in the data set between ranges. When I query group-ing by...

View Article

pg_restore a view

What’s the best way to restore a view? pg_dump -h hostname -d databasename -Fc > db.dump DROP VIEW viewname; pg_restore -h hostname -d databasename -t viewname db.dump This does not error, but also...

View Article


Best way to drop / recreate a table that has dependent views?

Problem PostgreSQL does not have logical column reordering, at least not in 9.2 If columns need to be added in the middle of a large table and order is important, the best way is to drop and recreate...

View Article


Update massively Wiki server directly in Postgres

I migrate a wiki that had a lot of broken link to a domain that no longer exist. How can I massively update my database, instead of change any single link? My idea is to connect in postgres and update...

View Article

Combine results of two queries, where the second relies on the first

I have one query which is returning name(text), total, created_at And another query which is returning the same thing name(text), total, created_at The second query usually is returning more rows, but...

View Article

VACUUM FULL fails with 'ERROR: Check free disk space'

I am using Postgres 9.4. I have a database that l+ tells me is 164 GB. When I try to run VACUUM FULL on the database, I get this error (after many hours): ERROR: could not extend file...

View Article

Prioritised table query

I’m looking for a way to query two tables at once but … I want the query to first run against Table A and then if Table A returns no matching records to query Table B. There many well be instances of...

View Article


Postgres: check disk space taken by materialized view?

I know how to check the size of indexes and tables in Postgres (I’m using version 9.4): SELECT relname AS objectname, relkind AS objecttype, reltuples AS "#entries",...

View Article

Running spatial query on huge table [duplicate]

This question already has an answer here: PostGIS doesn't use spatial index with ST_Intersects 4 answers

View Article


How do you unregister a table from a esri geodatabase?

How do you reverse the “Register with Geodatabase” operation? I reckon it isn’t uncommon to accidentally register (since it is the first option on Manage menu in ArcCatalog 10.2). Is there a tool (or...

View Article

Image may be NSFW.
Clik here to view.

Create a route by using points (pgRouting)

I’m currently working on a routing model for 17th and 18th century voyages. These routes are based on data from old shipping logbooks. I made a separate layer in QGIS which contains point. I exported...

View Article


Postgres – Insert performance with indexes

We have a table with about 20 columns in a Postgres 9.2.10 DB. For better performance on some SELECT queries, we plan to add an index on one column with data type timestamp. As the index also can slow...

View Article

Sampling and matching samples with spatial conditions

The Problem I have two tables with start points of a route and possible end points of a route which need to be matched against each other. I also have a given distribution for the distance between this...

View Article

Setting PostgreSQL data_directory in postgresql.conf not working

I’m attempting to configure PostgreSQL 9.3 on a Centos 6.6 box to keep the configuration files (postgresql.conf, pg_hba.conf, pg_ident.conf) in a different directory than the data directory. According...

View Article
Browsing all 1138 articles
Browse latest View live