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

Concurrent SELECT and UPDATE in multiprocessing python

I have to randomly match about 20 million rows in two tables without using the same row twice using PostgreSQL 9.3.5. Both tables have the following structure CREATE TABLE de_sim_points_end ( --...

View Article


Are A or D series VMs better for deploying PostgreSQL on Azure?

In Azure there are VMs that have local storage either as spinning disk (A-series) or SSD (D-series). Considering this space is wiped on reboot… Is there a benefit to choosing the SSD option for...

View Article


Can CTE sub-statements be prevented from executing at all?

Through this strategy, time consumed by queries for my application have dropped to extreme lows; however, some queries consume more milliseconds than necessary. The reason why is that upon examination...

View Article

Email address unique or primary key?

I am a newbie in databases. I read around and found out that it’s probably not a great idea to use email address as primary key because string comparisons are slower which effects performance in...

View Article

Upload SHP to PostgreSQL via QGIS

There was the error when I try to upload the SHP to the PostGRESQL. The feature is the line type. The error was: ERROR: Geometry type (LineString) does not match column type (MultiLineString) Do Anyone...

View Article


Learning pg_routing – shortest_path error

I’m learning PostGIS and pg_routing to help in our project planning and grant applications at my transportation agency (we wanted to move beyond the limitations of the 1/4 mile walking buffer we use so...

View Article

Image may be NSFW.
Clik here to view.

How to split linestrings where start/end points don't touch nearby lines

I am trying to figure out some basic routing with PostgreSQL/pgRouting and I’m struggling a bit. Our network of linestrings are not topologically correct, tracks that should be connected don’t touch,...

View Article

Table-based custom type does not verify check constraints

Is there any way for a table-based custom type to obey the table check constraints, other than creating my own type based on the table? Assume the following table that serves as a source for the custom...

View Article


How to select geography features within a certain distance given in miles?

I am just taking the first steps in using POSTGIS, but having trouble finding a simple example. I have a database with a Key field, lat and lon fields and a GEOGRAPHY field. I just want to have a query...

View Article


How do you drop an unnamed check constraint in a PostgresQL table?

I created a PostgresQL table but I added an unnamed check constraint on one of the columns: CREATE TABLE FOO ( id serial primary key, price_range smallint CHECK (price_range > 0), url varchar(255)...

View Article

What indexes should one use to optimize a PostgreSQL query with a JOIN depth...

Disclaimer: I am relatively new to PostgreSQL. I’m wondering how to optimize a query that does 2 INNER JOINs. My scenario is fairly simple: Select Posts with a photo (Posts.photo IS NOT NULL) and a...

View Article

postgresql unable to login

I created a user named ‘client’, witch refuses to connect. Here’s my client: CREATE ROLE client LOGIN ENCRYPTED PASSWORD 'md5d5bc32b75da65fe60067f501a4bb6665' NOSUPERUSER INHERIT NOCREATEDB...

View Article

can I give permission to insert into view, but not to referred table?

Here I have a view in public schema referring to the table in private schema: CREATE OR REPLACE VIEW public.products AS SELECT products.id, products.product_id, products.title, products.company_id FROM...

View Article


Modifying “pg_hba.conf” file to listen local TCP/IP conection

I am starting with PostGIS and there is an error when trying to connect through a TCP/IP connection. What I have done is: installed PostGre 9.3 in my PC, then installed PostGIS 2.3 for postGre 9.3,...

View Article

After upgrade from 9.1 to 9.3, commands still point to 9.1

Upgraded from 9.1 to 9.3 on my Ubuntu 12.04 server. Everything worked great but running commands like ‘createdb’ still runs them from the 9.1 path. /usr/lib/postgresql/9.1/bin/createdb: unrecognized...

View Article


copy data from public schema to another schema in postgresql

I’m creating a multi-tenant RoR app using PostgreSQL 9.3.5 running on linux (Ubuntu 14). I’d like to copy the data from my public schema to another schema. I tried: pg_dump -U my_username -h localhost...

View Article

Best way to handle multiple query keys

I am designing a postgresql database for an online card game. I want to provide users with the option to access their play history – users can see log of their games. The data I want to save has the...

View Article


How to optimize update using join in postgresql

I’m using PostgreSQL 9.3.5 on a CentOS system. I have a very large table (twenty million rows, 50+ column) that aggregates data from a few hundred systems. Several times a day each of the systems sends...

View Article

Postgresql doesn't accept replication connection

Plain old streaming replication. PostgreSQL: 9.2.7 Windows 8.1 64 bit My primary and secondary clusters are on same windows machine. I have already done pg_start_backup() and everything, so both...

View Article

How to get the geometry value from coordinates

I have a table with empty geometry column. I have two columns in the same table which has xcoordinate and ycoordinate values. I want to get the geometry value formed by these two coordinates. The...

View Article
Browsing all 1138 articles
Browse latest View live