Re: [GENERAL] Function PostgreSQL 9.2

2016-05-04 Thread drum.lu...@gmail.com
I'm just having some problem when doing: INSERT INTO public.users > (id,email,encrypted_password,sign_in_count,created_at,updated_at,company_id) > VALUES (66,'tes...@test.com','password','0','2016-05-03 > 00:01:01','2016-05-03 00:01:01','15'); - see that I'm not providing the "code" column value

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Szymon Lipiński
On 4 May 2016 at 23:52, Kus wrote: > > > On May 4, 2016 4:56:23 PM EDT, Andrew Sullivan > wrote: > >I think there's something that we're going to have to accept, however, > >and that's that there are way more application coders than there are > >people who really get database systems. Fixing th

Re: [GENERAL] Debian and Postgres

2016-05-04 Thread Zenaan Harkness
On 5/4/16, rob stone wrote: > On Wed, 2016-05-04 at 14:51 -0700, Adrian Klaver wrote: >> I ask because this looks somewhat similar to this thread: >> >> http://www.postgresql.org/message-id/CAM3xazWDA6asEDDYHcKF_5oSFP4SZj8 >> taVHwSF68wM=vmy7...@mail.gmail.com >> >> where the solution: >> >> http

Re: [GENERAL] Function PostgreSQL 9.2

2016-05-04 Thread John R Pierce
On 5/4/2016 9:56 PM, drum.lu...@gmail.com wrote: If I comment the line: *ELSEIF NEW.code IS NULL THEN*, the data is inserted into the users.code column. in the table definition, whats the default value of 'code' ? -- john r pierce, recycling bits in santa cruz

Re: [GENERAL] Function PostgreSQL 9.2

2016-05-04 Thread drum.lu...@gmail.com
On 5 May 2016 at 16:56, drum.lu...@gmail.com wrote: > CREATE OR REPLACE FUNCTION users_code_seq() >>RETURNS "trigger" AS $$ >> BEGIN >> >> IF (TG_OP = 'INSERT') THEN >> UPDATE public.company_seqs SET last_seq = (last_seq + 1) WHERE >> company_id = NEW.company_id; >> >>

Re: [GENERAL] Function PostgreSQL 9.2

2016-05-04 Thread drum.lu...@gmail.com
> > CREATE OR REPLACE FUNCTION users_code_seq() >RETURNS "trigger" AS $$ > BEGIN > > IF (TG_OP = 'INSERT') THEN > UPDATE public.company_seqs SET last_seq = (last_seq + 1) WHERE > company_id = NEW.company_id; > > ELSEIF NEW.code IS NULL THEN > SELECT last_seq INTO

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread George Neuner
On Tue, 3 May 2016 23:11:06 -0500, Guyren Howe wrote: >I've long been frustrated with how most web developers I meet >have no idea how to use an SQL database properly. I think I'm >going to write a book called Love Your Database, aimed at web >developers, that explains how to make their apps be

Re: [GENERAL] Debian and Postgres

2016-05-04 Thread John R Pierce
On 5/4/2016 1:55 PM, rob stone wrote: I can connect via psql and issue queries without any problems. Trying to connect via JDBC fails. Trying to connect by an application fails. one potential difference, psql will connect via a unix domain socket if you don't specify a -h hostname, while JDBC

Re: [GENERAL] Debian and Postgres

2016-05-04 Thread Adrian Klaver
On 05/04/2016 07:40 PM, rob stone wrote: On Wed, 2016-05-04 at 16:50 -0700, Adrian Klaver wrote: On 05/04/2016 04:38 PM, rob stone wrote: Hmm, it is Ubuntu not Debian, but: sudo apt-get remove whois vi /var/log/dpkg.log 2016-05-04 16:42:39 status installed whois:amd64 5.1.1 2016-05-04 16:

Re: [GENERAL] CREATE OR REPLACE AGGREGATE -- NOT!

2016-05-04 Thread David G. Johnston
On Wednesday, May 4, 2016, dandl wrote: > I was surprised to discover that > > · CREATE OR REPLACE AGGREGATE is not allowed, but > > · CREATE OR REPLACE FUNCTION works just fine > > > > Is this an oversight, or is there some reason I missed? > > Its not an oversight: but whether

Re: [GENERAL] Debian and Postgres

2016-05-04 Thread rob stone
On Wed, 2016-05-04 at 16:50 -0700, Adrian Klaver wrote: > On 05/04/2016 04:38 PM, rob stone wrote: > > > >  > Hmm, it is Ubuntu not Debian, but: > > sudo apt-get remove whois > > vi /var/log/dpkg.log > > 2016-05-04 16:42:39 status installed whois:amd64 5.1.1 > 2016-05-04 16:42:39 remove whois:a

[GENERAL] CREATE OR REPLACE AGGREGATE -- NOT!

2016-05-04 Thread dandl
I was surprised to discover that * CREATE OR REPLACE AGGREGATE is not allowed, but * CREATE OR REPLACE FUNCTION works just fine Is this an oversight, or is there some reason I missed? Yes, I know I can do: DROP AGGREGATE IF EXISTS CREATE AGGREGATE But this triggers a

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread dandl
From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Mike Sofen I disagree. I’ve worked as database architect/engineer at a number of large and small firms in various verticals (healthcare, financials, insurance, aerospace, telecom, etc), and crea

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Mike Sofen
From: dandlSent: Wednesday, May 04, 2016 5:05 PM To: 'Pierre Chevalier Géologue' > From: Pierre Chevalier Géologue [ > mailto:pierrechevalierg...@free.fr] > ... > > Then I think you've seriously misunderstood. Most people can indeed > >learn to writ

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Mike Sofen
>From: Vincent Veyron Sent: Wednesday, May 04, 2016 3:35 PM >I write management applications for businesses, and give _a lot_ of care to the database structure. >I find that the number of lines of code that need to be written is strictly inversely correlated to the >appropriateness of the data

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread dandl
> From: Pierre Chevalier Géologue [mailto:pierrechevalierg...@free.fr] > ... > > Then I think you've seriously misunderstood. Most people can indeed > >learn to write basic SQL queries, but those are > >(obviously) not what I'm talking about. > > > > To write the business logic of a significant app

Re: [GENERAL] Function PostgreSQL 9.2

2016-05-04 Thread Berend Tober
David G. Johnston wrote: On Wed, May 4, 2016 at 2:57 PM, drum.lu...@gmail.com ... I would expect a minimum of respect from the members of this list, but seems you got none. If someone would need my help, I'd never insult him/her like you guys are doing. If my questions are too "

Re: [GENERAL] Debian and Postgres

2016-05-04 Thread Adrian Klaver
On 05/04/2016 04:38 PM, rob stone wrote: On Wed, 2016-05-04 at 14:51 -0700, Adrian Klaver wrote: I can connect via psql and issue queries without any problems. Trying to connect via JDBC fails. Trying to connect by an application fails. Are you using the same connection parameters? In partic

Re: [GENERAL] Debian and Postgres

2016-05-04 Thread rob stone
On Wed, 2016-05-04 at 14:51 -0700, Adrian Klaver wrote: >  > > I can connect via psql and issue queries without any problems. > > Trying > > to connect via JDBC fails. Trying to connect by an application > > fails. > Are you using the same connection parameters? > > In particular are you using loc

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Vincent Veyron
On Tue, 3 May 2016 23:11:06 -0500 Guyren Howe wrote: > Any other thoughts? I like this quote from Fred Brooks : `Show me your code and conceal your data structures, and I shall continue to be mystified. Show me your data structures, and I won't usually need your code; it'll be obvious.' It

[GENERAL] Very slow update / hash join

2016-05-04 Thread Kurt Roeckx
Hi, I have an update query that's been running for 48 hours now. Since it started it used about 2.5% CPU, and is writing to the disk at about 3 MB/s, and reading at about 2 MB/s. It's mostly waiting for the disks. The query plan looks like this: QUER

Re: [GENERAL] Function PostgreSQL 9.2

2016-05-04 Thread David G. Johnston
On Wed, May 4, 2016 at 2:57 PM, drum.lu...@gmail.com wrote: > >> >> 1) I just may be over-sensitive to this, but after Adrian Klaver referred >> you to a ten-years old post that the above looks an awful lot similar too, >> it sure would be nice to see some attribution >> rather than claiming it a

Re: [GENERAL] Function PostgreSQL 9.2

2016-05-04 Thread drum.lu...@gmail.com
> > > > 1) I just may be over-sensitive to this, but after Adrian Klaver referred > you to a ten-years old post that the above looks an awful lot similar too, > it sure would be nice to see some attribution > rather than claiming it as your own with "...what *I* did..." > I would expect a minimum

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Kus
On May 4, 2016 4:56:23 PM EDT, Andrew Sullivan wrote: >I think there's something that we're going to have to accept, however, >and that's that there are way more application coders than there are >people who really get database systems. Fixing this problem requires >years of efforts. I don't r

Re: [GENERAL] Debian and Postgres

2016-05-04 Thread Adrian Klaver
On 05/04/2016 01:55 PM, rob stone wrote: Hello, This is a Debian problem that has caused a problem starting Postgres. So, I'm posting it here in the hope that somebody has experienced it previously and can assist me in fixing it. Yesterday, it started up as per normal and first command issued v

Re: [GENERAL] Debian and Postgres

2016-05-04 Thread Tom Lane
rob stone writes: > This is a Debian problem that has caused a problem starting Postgres. > Today, the following was in the log:- > 2016-05-05 03:44:53 AESTLOG:  test message did not get through on > socket for statistics collector > I can connect via psql and issue queries without any problems

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Andrew Sullivan
On Tue, May 03, 2016 at 11:11:06PM -0500, Guyren Howe wrote: > I've long been frustrated with how most web developers I meet have no idea > how to use an SQL database properly. I think I'm going to write a book called > Love Your Database, aimed at web developers, that explains how to make their

[GENERAL] Debian and Postgres

2016-05-04 Thread rob stone
Hello, This is a Debian problem that has caused a problem starting Postgres. So, I'm posting it here in the hope that somebody has experienced it previously and can assist me in fixing it. Yesterday, it started up as per normal and first command issued via JDBC driver was run:- 2016-05-04 10:39:

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Will McCormick
Yeah but your already paying for a developer ... On Wed, May 4, 2016 at 2:36 PM, Szymon Lipiński wrote: > > > On 4 May 2016 at 20:20, Will McCormick wrote: > >> I 100% agree with you. It's always been a problem but it is up to us to >> take ownership and provide value. Some would be surprising

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Guyren Howe
On May 4, 2016, at 11:59 , Paul Jungwirth wrote: > > I think teaching this is a different thing than just teaching SQL syntax. I > haven't seen it written about a lot. It must be somewhere, but any book > encouraging "outsiders" to use more SQL could benefit from giving them > direction like t

Re: [GENERAL] Debugging code on server?

2016-05-04 Thread Szymon Lipiński
On 4 May 2016 at 20:30, Thomas Kellerer wrote: > Guyren Howe schrieb am 04.05.2016 um 18:43: > >> This is a fork from my "Love your database" question. It's a >> separable concern, so I moved it here. >> >> Let's say I want to use Postgres' *amazing* support for lots of >> languages. I want to us

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Szymon Lipiński
On 4 May 2016 at 20:20, Will McCormick wrote: > I 100% agree with you. It's always been a problem but it is up to us to > take ownership and provide value. Some would be surprising shocked how > simple it is to manage the Data access layer once the framework is in place > regardless of what it is

Re: [GENERAL] Debugging code on server?

2016-05-04 Thread Thomas Kellerer
Guyren Howe schrieb am 04.05.2016 um 18:43: This is a fork from my "Love your database" question. It's a separable concern, so I moved it here. Let's say I want to use Postgres' *amazing* support for lots of languages. I want to use Javascript or PERL or Ruby or something. How do I debug the cod

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Will McCormick
I 100% agree with you. It's always been a problem but it is up to us to take ownership and provide value. Some would be surprising shocked how simple it is to manage the Data access layer once the framework is in place regardless of what it is written in. For the same reasons you wouldn't typically

Re: [GENERAL] Debugging code on server?

2016-05-04 Thread Vick Khera
Good old fashioned "print" :) I tend to use RAISE DEBUG, and look in the logs. The most complicated procedures we have in our system are enforcing state diagram changes for a given field that tracks an object status, so maybe this doesn't scale well. On Wed, May 4, 2016 at 12:43 PM, Guyren Howe

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Szymon Lipiński
On 4 May 2016 at 19:09, Will McCormick wrote: > I agree that it's not like turning on the light switch. And I'm not > implying there isn't a logic layer between the database and the > application. Based off my past experiences I would likely not put business > logic in the database unless it was

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Will McCormick
I agree that it's not like turning on the light switch. And I'm not implying there isn't a logic layer between the database and the application. Based off my past experiences I would likely not put business logic in the database unless it was a critical for performance. This does not make it portab

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Paul Jungwirth
On 05/04/2016 08:39 AM, Paul Jungwirth wrote: On 05/03/2016 09:11 PM, Guyren Howe wrote: I think I'm going to write a book called Love Your Database, aimed at web developers I gave a talk here about doing "interesting" Postgres things in Rails: Oh also: one part of my talk I did like what gi

[GENERAL] Debugging code on server?

2016-05-04 Thread Guyren Howe
This is a fork from my "Love your database" question. It's a separable concern, so I moved it here. Let's say I want to use Postgres' *amazing* support for lots of languages. I want to use Javascript or PERL or Ruby or something. How do I debug the code? I can imagine things you might set up: u

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Szymon Lipiński
On 4 May 2016 at 18:14, Will McCormick wrote: > I agree it's typically political but so are most things business. > Examples: Companies buy other companies - You are using a competitors data > store and want to replace it. Company needs to compete with competitors > and wants to reduce cost ...

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Geoff Winkless
On 4 May 2016 at 17:14, Will McCormick wrote: > Examples: Companies buy other companies - You are using a competitors data > store and want to replace it. Company needs to compete with competitors and > wants to reduce cost ... Or, let's say, massive multibillion-dollar DBMS competitor buys s

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Will McCormick
I agree it's typically political but so are most things business. Examples: Companies buy other companies - You are using a competitors data store and want to replace it. Company needs to compete with competitors and wants to reduce cost ... these are not technical requirements and it's certainly

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Alban Hertroys
On 4 May 2016 at 17:08, John McKown wrote: > I had a manager, long ago, who used a Lotus 1-2-3 spreadsheet to > contain all his memos. I was glassy eyed in disbelief. He also would use his > hand calculator to add up the numbers in the spreadsheet to be sure that the > summation function in the sp

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Paul Jungwirth
On 05/03/2016 09:11 PM, Guyren Howe wrote: I think I'm going to write a book called Love Your Database, aimed at web developers What might I cover that I haven't mentioned? What are the usual objections to server-side code and how can they be met? When *are* they justified and what should the

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread John McKown
On Wed, May 4, 2016 at 9:55 AM, Pierre Chevalier Géologue < pierrechevalierg...@free.fr> wrote: > Le 04/05/2016 15:25, John McKown a écrit : > >> On Wed, May 4, 2016 at 8:13 AM, Geoff Winkless > >wrote: >> >> ​ >> >> The sensible way is to do it as John wrote -

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Steve Crawford
On Wed, May 4, 2016 at 8:04 AM, Steve Crawford < scrawf...@pinpointresearch.com> wrote: > First, you hit them over the head with a copy of "SQL Antipatterns: > Avoiding the Pitfalls of Database Programming". It is a tad out of date and > tends to use PHP and MySQL for the main examples but does al

Re: [GENERAL] Insert only table and size of GIN index JSONB field.

2016-05-04 Thread Jeff Janes
On Wed, May 4, 2016 at 1:39 AM, Maxim Boguk wrote: >> This sounds like a known issue, fixed in 9.6, where the pages used for >> the pending list do not eligible for recycling until the table is >> vacuumed. Autovacuum does not run on insert only tables, so they just >> accumulate as empty pages

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Steve Crawford
Perhaps a bit US centric but PHB = Pointy Haired Boss. See the boss in "Dilbert". Cheers, Steve On Wed, May 4, 2016 at 7:55 AM, Pierre Chevalier Géologue < pierrechevalierg...@free.fr> wrote: > Le 04/05/2016 15:25, John McKown a écrit : > >> On Wed, May 4, 2016 at 8:13 AM, Geoff Winkless >

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Will McCormick
A reason to consider may be portability. What happens if I want to let my customer chose their data store or I just don't want to put all my eggs in one basket.Technically there are truths but you cannot ignore the business side either. If a we can exceed our performance requirements and keep thing

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Steve Crawford
First, you hit them over the head with a copy of "SQL Antipatterns: Avoiding the Pitfalls of Database Programming". It is a tad out of date and tends to use PHP and MySQL for the main examples but does also address different solutions available in PostgreSQL, Oracle. MS SQL server, etc. while point

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Pierre Chevalier Géologue
Le 04/05/2016 15:25, John McKown a écrit : On Wed, May 4, 2016 at 8:13 AM, Geoff Winkless mailto:pgsqlad...@geoff.dj>>wrote: ​ The sensible way is to do it as John wrote - to restrict access rights to everyone except admin to calling functions only. That way the functions are wr

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Pierre Chevalier Géologue
Le 04/05/2016 13:36, dandl a écrit : ... Then I think you've seriously misunderstood. Most people can indeed learn to write basic SQL queries, but those are (obviously) not what I'm talking about. To write the business logic of a significant application entirely in SQL requires PLSQL (or in othe

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Pierre Chevalier Géologue
Hi, Le 04/05/2016 13:36, Szymon Lipiński a écrit : On 4 May 2016 at 13:13, Chris Travers mailto:chris.trav...@gmail.com>> wrote: A few observations On Wed, May 4, 2016 at 12:31 PM, Geoff Winkless mailto:pgsqlad...@geoff.dj>> wrote: On 4 May 2016 at 06:46, dandl mailto:da...@and

Re: [GENERAL] ruby pg connection fails on centos - okay on debian and dev machine

2016-05-04 Thread Adrian Klaver
On 05/04/2016 05:26 AM, john.tiger wrote: On 05/03/2016 06:18 PM, Adrian Klaver wrote: On 05/03/2016 05:07 PM, john.tiger wrote: our model.rb runs fine on a dev machine and a debian server but is failing on a new centos server - checked the postgres db name and user name and password - all see

Re: [GENERAL] Do parallel queries work with only dblink not with fdw?

2016-05-04 Thread Marc Mamin
>From: pgsql-general-ow...@postgresql.org >[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Klaus P. >Sent: Mittwoch, 4. Mai 2016 10:28 >To: pgsql-general@postgresql.org >Subject: [GENERAL] Do parallel queries work with only dblink not with fdw? > >In order to improve cpu and disk utilizat

Re: [GENERAL] Do parallel queries work with only dblink not with fdw?

2016-05-04 Thread kpi6288
> -Ursprüngliche Nachricht- > Von: Adrian Klaver [mailto:adrian.kla...@aklaver.com] > > I am not sure of the status of parallel query in FDW, but for those that are > some > more information would be helpful: > > 1) You are using postgres_fdw, correct? Yes. > > 2) What version of the

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Melvin Davidson
On Wed, May 4, 2016 at 9:25 AM, John McKown wrote: > On Wed, May 4, 2016 at 8:13 AM, Geoff Winkless > wrote: > >> ​ >> >> The sensible way is to do it as John wrote - to restrict access rights >> to everyone except admin to calling functions only. That way the >> functions are written by the peo

Re: [GENERAL] Do parallel queries work with only dblink not with fdw?

2016-05-04 Thread Adrian Klaver
On 05/04/2016 01:28 AM, Klaus P. wrote: In order to improve cpu and disk utilization, I am testing parallel queries. The approach with dblink_send_query() and dblink_get_result() works in my proof-of-concept. Runtime of my reference query was reduced from 55 seconds to ~20seconds using 4 paralle

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread John McKown
On Wed, May 4, 2016 at 8:13 AM, Geoff Winkless wrote: > ​ > > The sensible way is to do it as John wrote - to restrict access rights > to everyone except admin to calling functions only. That way the > functions are written by the people who are paid to understand the > business rules and the dat

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Geoff Winkless
On 4 May 2016 at 12:36, Szymon Lipiński wrote: > From my perspective there is one more thing: when I tried, in couple of > companies, to move some part of the logic to a database, then usually the > management said "no, that's not doable, as we will have trouble with finding > good sql programmers

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Sándor Daku
On 4 May 2016 at 13:36, Szymon Lipiński wrote: > > > On 4 May 2016 at 13:13, Chris Travers wrote: > >> A few observations >> >> On Wed, May 4, 2016 at 12:31 PM, Geoff Winkless >> wrote: >> >>> On 4 May 2016 at 06:46, dandl wrote: >>> > I'm a strong believer in putting the business code next to

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread John McKown
On Wed, May 4, 2016 at 7:55 AM, Szymon Lipiński wrote: ​​ > Hi, > at my previous jobs I was working with many programmers, and almost none > of them understood SQL. The problem was even deeper. They didn't want to > learn it. When I was working among java programmers, I noticed that they > hated

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Szymon Lipiński
On 4 May 2016 at 06:11, Guyren Howe wrote: > I've long been frustrated with how most web developers I meet have no idea > how to use an SQL database properly. I think I'm going to write a book > called Love Your Database, aimed at web developers, that explains how to > make their apps better by l

Re: [GENERAL] Function PostgreSQL 9.2

2016-05-04 Thread Berend Tober
On Tuesday, May 3, 2016, drum.lu...@gmail.com mailto:drum.lu...@gmail.com>> wrote: * This is what I did... |-- Creating the table CREATE TABLE public.company_seqs (company_id BIGINTNOT NULL, last_seq BIGINTNOT NULL DEFAULT

Re: [GENERAL] ruby pg connection fails on centos - okay on debian and dev machine

2016-05-04 Thread john.tiger
On 05/03/2016 06:18 PM, Adrian Klaver wrote: On 05/03/2016 05:07 PM, john.tiger wrote: our model.rb runs fine on a dev machine and a debian server but is failing on a new centos server - checked the postgres db name and user name and password - all seem fine The error message is? could it

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Szymon Lipiński
On 4 May 2016 at 13:13, Chris Travers wrote: > A few observations > > On Wed, May 4, 2016 at 12:31 PM, Geoff Winkless > wrote: > >> On 4 May 2016 at 06:46, dandl wrote: >> > I'm a strong believer in putting the business code next to the data, >> not the wrong >> > side of the object-relational

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread dandl
> ow...@postgresql.org] On Behalf Of Geoff Winkless > > I'm a strong believer in putting the business code next to the data, > > not the wrong side of the object-relational divide. However, for many > > the challenge of writing and debugging SQL code is just too high! > > Your source for this sta

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Chris Travers
A few observations On Wed, May 4, 2016 at 12:31 PM, Geoff Winkless wrote: > On 4 May 2016 at 06:46, dandl wrote: > > I'm a strong believer in putting the business code next to the data, not > the wrong > > side of the object-relational divide. However, for many the challenge of > writing and >

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Geoff Winkless
On 4 May 2016 at 06:46, dandl wrote: > I'm a strong believer in putting the business code next to the data, not the > wrong > side of the object-relational divide. However, for many the challenge of > writing and > debugging SQL code is just too high! Your source for this statement please? "For

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Bill Moran
On Tue, 3 May 2016 23:11:06 -0500 Guyren Howe wrote: > I've long been frustrated with how most web developers I meet have no idea > how to use an SQL database properly. I think I'm going to write a book called > Love Your Database, aimed at web developers, that explains how to make their > app

Re: [GENERAL] Insert only table and size of GIN index JSONB field.

2016-05-04 Thread Maxim Boguk
On Wed, May 4, 2016 at 3:45 AM, Jeff Janes wrote: > On Tue, May 3, 2016 at 3:09 AM, Maxim Boguk wrote: > > Hi, > > > > I started with empty table with index over > > custom_fields | jsonb > > field > > defined as: > > "idx_learners_custom_fields" gin (custom_fields) > > Globally gin_pending

Re: [GENERAL] Vacuum full of parent without partitions possible?

2016-05-04 Thread Jan Keirse
On Tue, May 3, 2016 at 3:22 PM, Tom Lane wrote: > Jan Keirse writes: > > I have a table that used to contain all data. > > because it grew too big I added a partition trigger a long time ago and > > since than all new data was added to small partitions. By now all data in > > the original parent

[GENERAL] Do parallel queries work with only dblink not with fdw?

2016-05-04 Thread Klaus P.
In order to improve cpu and disk utilization, I am testing parallel queries. The approach with dblink_send_query() and dblink_get_result() works in my proof-of-concept. Runtime of my reference query was reduced from 55 seconds to ~20seconds using 4 parallel connections. Not what I had hoped but ce

Re: [GENERAL] Thoughts on "Love Your Database"

2016-05-04 Thread Chris Travers
I think one of the key questions is when to put logic in the database (and this is controversial so it may be worth covering from a few angles). In general my view is: 1. Data logic belongs in the database 2. Logic you can't roll back belongs somewhere else 3. A lot of stuff could go either pl

Re: [GENERAL] MVIEW refresh consistently faster then insert ... select

2016-05-04 Thread Thomas Kellerer
Kevin Grittner schrieb am 04.05.2016 um 09:06: > On Wed, May 4, 2016 at 1:46 AM, Thomas Kellerer wrote: > >> I have a table that is an aggregation of another table. >> This aggregation reduces an input of ~14 million rows to ~4 >> million rows. > >> The refresh takes approx 2 minutes (fastest wa

Re: [GENERAL] MVIEW refresh consistently faster then insert ... select

2016-05-04 Thread Kevin Grittner
On Wed, May 4, 2016 at 1:46 AM, Thomas Kellerer wrote: > I have a table that is an aggregation of another table. > This aggregation reduces an input of ~14 million rows to ~4 > million rows. > The refresh takes approx 2 minutes (fastest was 1:40) on our > development server (CentOS, Postgres 9.5