Quantcast
Browsing all 77 articles
Browse latest View live

Slow window function query with big table

I’m doing some performance testing on a new DB design on PostgreSQL 9.4rc1 and I’m seeing some pretty slow queries using window functions. Here is my table setup: CREATE TABLE player_stat ( player_id...

View Article


Can Postgres index regular expressions stored in a column?

I’ve got regular expressions stored as varchars in a column, which I need to match against incoming input. For example, the table might contain: | field | value | |-------|---------------| | email |...

View Article


Do not reject entire statement when deleting rows in batch

I have a table who’s purpose is to store the application’s various images. It is defined this way : CREATE TABLE images ( id lo NOT NULL, name character varying(1024) NOT NULL, type character...

View Article

testing script to update the database [closed]

When I run the following code in psql the following error appears: Code CREATE OR REPLACE FUNCTION fct_isslave ()   RETURNS SETOF character varying AS $ BODY $ BEGIN     RETURN QUERY SELECT CASE...

View Article

Get even / odd / all numbers between two numbers

I want to display all the numbers (even / odd / mixed) between two numbers (1-9; 2-10; 11-20) in one (or two) column. Example initial data: | rang | | r1 | r2 | -------- -----|----- | 1-9 | | 1 | 9 | |...

View Article


Trigram search gets much slower as search string gets longer

In a Postgres 9.1 database, I have a table table1 with ~1.5M rows and a column label (simplified names for the sake of this question). There is a functional trigram-index on lower(unaccent(label))...

View Article

Not able to install PostgreSQL 9.4 on Ubuntu

When I try to install PostgreSQL 9.4.+ on Ubuntu, it is installing version 9.3.9. I have used the following command: sudo apt-get install postgresql postgresql-contrib Then I have tried with sudo...

View Article

pg_dump – schema not found

I am trying to dump a schema from Postgres 9.4, running on Cents 6.5, but I get an error: pg_dump: No matching schemas were found Here is the command I am running: pg_dump -U postgres -n...

View Article


Cannot read from /tmp with PostgreSQL COPY, but able to read the same file...

I have a file /tmp/foo.csv that looks like this: 1,2 10,20 100,200 I have the same exact file in another directory /mydata/foo.csv. Both directories and files have the same exact permissions, owner,...

View Article


PostgreSQL lost connection during massive index operation? What exactly...

Using PostgresQL 9.4, Ubuntu 14.04, and 32 GB RAM (with modified settings in postgresql.conf file; I think the highest allocation is 16GB). I ran a ts_vector creation on a text column in a table...

View Article

How round in Postgres?

when we use SUM on a data table gives a 1 or 2 cents of difference due to rounding in Postgres. We are using Postgres 9.4, the field data types is numeric with 19,3 and the result have to be with two...

View Article

Can't read config files from pgAdminIII on local Kubuntu machine

My database starts fine, I can connect to it from pgAdmin and run queries. However when I go to Tools->Server Configuration->postgresql.conf I get an error. The error states could not stat file...

View Article

Do I need to specify –clean and –create on both pg_dump and pg_restore?

Pretty simple question. I seem to be getting mixed results when using one or the either and would appreciate a definitive answer.

View Article


How do I uniquely update values of a text column before applying UNIQUE...

I need to apply a unique constraint to a TEXT field which may or may not already contain duplicate values. If for instance I have ABC twice, I don’t mind renaming them as ABC-1, ABC-2, but what if I...

View Article

Query with limit and order by runs too slow

I have the following table: CREATE TABLE dpg2 ( account_id integer NOT NULL, tank_id integer NOT NULL, battles integer, dmg integer, frags integer, wins integer, recent_battles integer[], recent_dmg...

View Article


PgAgent unable to run a job

I am running PostgreSQL 9.4.5 on Ubuntu 14.04.3. I am trying to set up pgAgent job but I keep getting this error: DEBUG: Creating DB connection: user=xxx host=localhost port=5432 dbname=otherdb...

View Article

“ERROR: there is no parameter $1” in “EXECUTE .. USING ..;” statement in plpgsql

I have a plpgsql function to create child tables using table inheritance in PostgreSQL like this: CREATE TABLE parent_table ( value integer, end_time timestamp without time zone ); CREATE OR REPLACE...

View Article


Image may be NSFW.
Clik here to view.

How to convert a Postgresql ltree structure to a nested set by using VIEW?

I would like to ask a question about a way for transforming a PostgreSQL ltree structure to a nested set structure with only one query by using only VIEWs. For example, I have a table which has data...

View Article

Improving PostgreSQL cluster performance

I am trying to cluster my table faster. The table is 27 GB worth of data, and has one index using a point geometry which is 19 GB in size. I am seeing about 5.5 hours to cluster the table. I am...

View Article

How to handle this complicated join condition(s)?

drop table if exists company_tags; drop table if exists project_tags; drop table if exists companies; drop table if exists projects; drop table if exists tags; create table companies (id serial primary...

View Article
Browsing all 77 articles
Browse latest View live