Re: [GENERAL] Designing tables based on user input and defined values

2016-02-27 Thread David G. Johnston
On Sat, Feb 27, 2016 at 10:36 PM, Adrian Klaver wrote: > On 02/27/2016 09:19 PM, Aaron Christensen wrote: > >> There is somewhat a method to this madness :). There isn't a formula >> that determines outcome. They will just be arbitrary values that I >> assign. >> >> Obviously, I'm new to SQL bu

Re: [GENERAL] Designing tables based on user input and defined values

2016-02-27 Thread Adrian Klaver
On 02/27/2016 09:19 PM, Aaron Christensen wrote: There is somewhat a method to this madness :). There isn't a formula that determines outcome. They will just be arbitrary values that I assign. Obviously, I'm new to SQL but I'm trying to understand your suggestion. It appears that table Final h

Re: [GENERAL] Designing tables based on user input and defined values

2016-02-27 Thread Aaron Christensen
There is somewhat a method to this madness :). There isn't a formula that determines outcome. They will just be arbitrary values that I assign. Obviously, I'm new to SQL but I'm trying to understand your suggestion. It appears that table Final has the composite/primary keys of goal and size whic

Re: [GENERAL] multiple UNIQUE indices for FK

2016-02-27 Thread David G. Johnston
> > W dniu 23.02.2016 o 09:39, Rafal Pietrak pisze: > > Can anybody suggest any other way out of this mass? > ​The only thought that sticks while reading your prose is:​ ​message > message-person < person​ ​message-person (message_id, person_id, relationship_type[sender, receiver]) Par

Re: [GENERAL] Designing tables based on user input and defined values

2016-02-27 Thread Adrian Klaver
On 02/27/2016 03:12 PM, Aaron Christensen wrote: Hi Adrian, Thank you for responding with the SQL code. However, outcome cannot be a primary key because outcome values will be duplicates in some instances. I am not sure how else to have a lookup table that stores static values. Well first is

Re: [GENERAL] Designing tables based on user input and defined values

2016-02-27 Thread Aaron Christensen
Hi Adrian, Thank you for responding with the SQL code. However, outcome cannot be a primary key because outcome values will be duplicates in some instances. I am not sure how else to have a lookup table that stores static values. Thanks! Aaron On Sat, Feb 27, 2016 at 5:15 PM, Adrian Klaver wr

Re: [GENERAL] Designing tables based on user input and defined values

2016-02-27 Thread Adrian Klaver
On 02/27/2016 01:15 PM, Aaron Christensen wrote: Hello, I am trying to figure out the correct way to design the database table to support the following situation. To start, I have an Excel spreadsheet that maps particular combinations of Goal and Size to an Outcome. Goal choices are "Long", "A

[GENERAL] Designing tables based on user input and defined values

2016-02-27 Thread Aaron Christensen
Hello, I am trying to figure out the correct way to design the database table to support the following situation. To start, I have an Excel spreadsheet that maps particular combinations of Goal and Size to an Outcome. Goal choices are "Long", "Average", and "Short". Size choices are "Big", "Med

Re: [GENERAL] multiple UNIQUE indices for FK

2016-02-27 Thread Rafal Pietrak
hi, May be someone could help me with this SQL problem. I'm still fighting with the "message system" I've explained in my initial mail (apppended here, since some time have passed since). Currently I tried "partial indeces" for FK, but either it's entirely unsuitable for the purpose ... or I hav

Re: [GENERAL] How jsonb updates affect GIN indexes

2016-02-27 Thread Francisco Olarte
CCing to list to maintain context. On Sat, Feb 27, 2016 at 12:14 PM, Eric Mortensen wrote: > Thanks Francisco, I had not considered MVCC. If that is true, it would seem > to me that a GIN index would "always" be less efficient, as it potentially > would have to update every key's posting tree if

Re: [GENERAL] How jsonb updates affect GIN indexes

2016-02-27 Thread Francisco Olarte
Eric: On Sat, Feb 27, 2016 at 11:46 AM, Eric Mortensen wrote: > When a jsonb column is updated, as far as I understand the entire column is > updated, even though perhaps only one of the keys has a modified value. Also, bear in mind when a column is updated the tuple is too, and MVCC treats it s

[GENERAL] How jsonb updates affect GIN indexes

2016-02-27 Thread Eric Mortensen
Hi When a jsonb column is updated, as far as I understand the entire column is updated, even though perhaps only one of the keys has a modified value. My question is: if I have a GIN index on that column, will PG visit every key and update each index entry, or will it visit every key and update e