Syntax error in postgresql query [closed]
I am trying to migrate a sql query into PostgreSQL. After running the query I get this error: ERROR: syntax error at or near "(" LINE 20: ..._date is null or fcm.effect_end_date>=current_date())...
View ArticleAccurate PG database size for comparing representations
I have a Java/JDBC program that takes a sample file and imports the data into the database, shredding it across multiple relations. The program does this multiple times for several different...
View ArticleMigrating PostgreSQL files to new server
We have a Win 2008 server that went down because of cpu failure. We were running parts of the Atlassian stack (JIRA, Confluence, Stash, and Bamboo) on it using PostgreSQL as the database. I now have...
View ArticleHow to reinstall PostgreSQL over an existing installation
I am trying to upgrade an installer created with NSIS that installs postgresql. It used to install postgresql 8.3 but we want to upgrade the DB to 9.4.4. The old version on of the DB used to be an MSI...
View ArticleRetrieve additional columns in recursive CTE
This works as far as getting the amount of children a “thread” has but now I can’t seem to get it to pull parent row columns. Parent rows have parent_id is null, trees can be any level deep. I manage...
View ArticleSafe to Restore Database from Untrusted Sources
I am asking someone to aggregate around 100GB of data for me. I would prefer this to be in a Postgres database instead of something like CSV. I was thinking pg_dump and pg_restore custom format. Is it...
View ArticleHow would I make this query run faster in postgres [closed]
Query: with customer_total_return as (select wr_returning_customer_sk as ctr_customer_sk ,ca_state as ctr_state, sum(wr_return_amt) as ctr_total_return from web_returns ,date_dim ,customer_address...
View ArticleManaging and speeding up queries on PostgreSQL table with over 3 trillion rows
I have time series data which spans over 10 years and has over 3 trillion rows and 10 columns. At the moment I use a PCIe SSD with 128GB of RAM and I am finding that querying takes a significant amount...
View ArticlePerformance issues with inherited tables and indices
I have a PostgreSQL database with a master table and 2 child tables. My master table: CREATE TABLE test ( id serial PRIMARY KEY, date timestamp without time zone ); CREATE INDEX ON test(date); My child...
View ArticleWhere to store lat/lon data with additional informations?
I have huge database of lat/lon GPS coordinate points. For every point, I have several other variables (height, surface type, temperature, pressure…). Also, data will be changed every day and old ones...
View ArticlePostgres data integration
Consider a scenario where I have 3 standalone running Postgres engines that are installed on three separate machines. The data on this machine is inserted, updated or removed each month by employees....
View ArticleHow to create a trigger for multiple schemas?
One of my PostgreSQL databases contains different schemas which share the same structure. -- schema region_a CREATE TABLE region_a.point ( gid serial NOT NULL, geom geometry(point, SRID),...
View ArticlePagination – Text comparison with greater than and less than with DESC
I am implementing a seek method for pagination and am wondering about how to best query on a text column with DESC. The queries for this seek approach use a less than or greater than depending on if...
View ArticleTo minimize Cache misses in PostgreSQL?
You can calculate cache misses as described here. However, I am interested in how to minimize the phenomenon. I have some algorithms that are based on hash tables, which cause much cache misses by...
View ArticleCombine two event tables into a single timeline
Given two tables: CREATE TABLE foo (ts timestamp, foo text); CREATE TABLE bar (ts timestamp, bar text); I wish to write a query that returns values for ts, foo, and bar that represents a unified view...
View ArticleTo find data in Multiple tables and delete it?
I am using a PostgreSQL server. Suppose I have 200 values in a master table that need to be deleted. There are 9 other tables referencing this master table. The other 9 tables not only reference the...
View Articlepostgresql – how and why indexes are bigger than their tables
I’m using postgresql 9.3 and trying to understand how and why indexes are bigger than their tables. Sample output: database_name | database_size | table_name | table_size | indexes_size | total_size...
View ArticleComparing the data in two Postgres databases
I am looking for a way to compare the data in two Postgres databases. Basically a ‘Before’ and ‘After’ snapshot of a transaction being posted. What I am looking for is all the tables/records that have...
View ArticleUse pg_dump with postgis extensions?
I’m using Postgres 9.4. I’m trying to dump a database (both the schema and the actual data) with the PostGIS extensions (set up using CREATE EXTENSION): $ pg_dump prescribing -U prescribing -h...
View ArticleHow to create MBtiles from geoserver
How to generate mbtiles in geoserver? using openlayers for displaying geoserver layer for example calling wms layer like this new OpenLayers.Layer.WMS("Kanpur", "http://localhost:8080/geoserver/wms", {...
View Article