Postgresql indexing for IS NULL
I have two similar queries, whose only difference (in the last two lines) is that one uses IS NULL while the other compares defined values. Query #1 takes only a few minutes: UPDATE...
View Articledifferent calculation results
I spend a comparison of functions of spatial analysis and Oraсle postgresql. There are two tables with the same coordinate system – tech_bridge. oracle query select...
View Articlepg_dump Database that was populated with osm2pgsql
Is it possible to dump a postgres database that was created with osm2pgsql and a .osm.pbf file with pg_dump and import this into a remote postgres database? After running osm2pgsql the database is 135...
View ArticleFull text search on two tsvector columns
I’m trying to do a full text search across two columns of two separate tables in PostgreSQL 9.4.2. The tables and columns are: article.article_title keyword.keyword Where there is a many-to-many...
View ArticleUnexpected results with soundex() function when combined st_distance()
select soundex(A.name), A.gid, A.name, soundex(B.name), B.gid, B.name, st_distance(B.the_geom,A.the_geom) * 111.325 as dist from (select name, gid, the_geom, count(soundex(name)) over (partition by...
View ArticleHow to update array fields in a table in Postgresql?
Say I have a table defined as following: CREATE TABLE my_tbl ( id bigint, a1 bigint[], a2 bigint[] ); I would like to create a stored procedure to append values to a1 and a2. Is this the right way to...
View ArticlePostgreSQL query – works locally but not on AWS RDS
We have a large query that works fine locally but deadlocks on AWS RDS. According to cloudwatch we are not resource bound on CPU, disk or iops and nothing else should be accessing these tables. The...
View ArticleSetting shared_buffers in postgresql.conf does not seem to take effect
We’re on CentOS release 6.6, PostgreSQL version 8.4.20. (Yes, this is not bleeding edge.) In postgresql.conf, we have: shared_buffers = 4096MB kernel shm values are set nice and high: [root@green...
View ArticlePostgresql upgrade issue
I’m trying to test the Postgresql 9.3 -> 9.4 upgrade process on the development environment on windows and I get weird issue during the pg_upgrade invocation: PS D:binpostgres-9.4>...
View ArticleRunning `gman_servers_set` in PostgreSQL's startup
I’ve compiled PostgreSQL’s gearman extension and now I can connect to a gearman server using triggers and such in PostgreSQL. As you may know, before a job can be registered in a gearman server, you...
View ArticleAdding data column by column in postgreSQL database
I organize my data in different txt files and dat. files, mostly in each file there is one specific column of data. Now I want to import and combine 4 of them to create a table. Say I have one file for...
View Articlepostgresql how can i get list of trigger which are fired when function X is...
my goal is to list all trigger names which are working when function X is working. i assumed it has something to do with pg_proc and pg_constraints but i couldn’t figure it out.
View Articlepostgresql double count query
I have a table with 3 columns: key, status and rank. status contains numbers and rank contains t or f. key is auto numbered and irrelevant here. my goal is to count how many in each status are t and...
View ArticleWhy does connecting to '127.0.0.1' work whilst 'localhost' fails?
I have noticed that although the listening host in postgresql.conf is localhost connecting to a database via psql fails unless the host is changed 127.0.0.1. I have also noticed MySQL display the same...
View ArticleFind substrings within between 2 string fragments
I am trying to populate a view in PostGIS in Postgres 9.0 and in this view I want it to contain a substring based on 2 string positions. See below for my code. CREATE OR REPLACE VIEW vw_actions AS...
View ArticleUpdate staging data with production data in Postgresql
I’m using PostgreSQL (version 9.3) on my server and I want to update the data in my staging instance database with the data in my production instance database. Each database is controlled by a...
View ArticleDoes VACUUM FULL need ANALYZE
I’d be grateful for some insight into the VACUUM functionality within PostgreSQL 9.3. I read through the documentation and searched around a bit but could not find a definitive answer to this. I’m...
View ArticleLocal Backup from Amazon RDS PostgreSQL database
I have a PostgreSQL database on an Amazon RDS instance. I want to have a local dump of this instance. So far, I’ve tried with this: PGPASSWORD="Password" pg_dump -h...
View ArticlePostgres 9.4.4 query takes forever
We’re running Postgres 9.4.4 on CentOS 6.5 and have a SELECT query that has worked for years, but stopped working and hangs after we upgraded from 9.2 (it took a while to notice it, so I don’t know if...
View ArticleLocking in Postgres for UPDATE / INSERT combination
I have two tables. One is a log table; another contains, essentially, coupon codes that can only be used once. The user needs to be able to redeem a coupon, which will insert a row into the log table...
View Article