Re: [GENERAL] Is it possible to create an index without keeping the indexed data in a column?

2014-08-01 Thread Amit Langote
On Fri, Aug 1, 2014 at 2:50 PM, Amit Langote amitlangot...@gmail.com wrote: Not sure exactly if it applies here; Re-reading the OP again, perhaps it doesn't. Sorry about the noise -- Amit -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your

[GENERAL] Upgrading from 9.0.11 to 9.3.5 on CentOS 6 (64 bit)

2014-08-01 Thread Phoenix Kiula
Hello, I have Postgresql from a few years ago. That's 9.0.11. During the vacuum it's basically crawling to its knees. While googling for this (it stops at pg_classes forever) I see Tom Lane suggested upgrading. So now I must. In doing so, can I follow these instructions?

Re: [GENERAL] Upgrading from 9.0.11 to 9.3.5 on CentOS 6 (64 bit)

2014-08-01 Thread John R Pierce
On 7/31/2014 11:09 PM, Phoenix Kiula wrote: I have Postgresql from a few years ago. That's 9.0.11. you can upgrade to 9.0.18 painlessly. 9.1 or .2 or .3, not quite so painless. During the vacuum it's basically crawling to its knees. While googling for this (it stops at pg_classes

[GENERAL] Very Limited Toast Compression on JSONB (9.4 beta 2)

2014-08-01 Thread Jeff Janes
On Thursday, July 31, 2014, Larry White ljw1...@gmail.com javascript:_e(%7B%7D,'cvml','ljw1...@gmail.com'); wrote: Hi, I'm running an experiment on 9.4 beta 2. I put 275,000 identical JSON files into a table using JSONB (one per row). Each raw text file is 251K in size, so the total

Re: [GENERAL] Re: User-defined operator function: what parameter type to use for uncast character string?

2014-08-01 Thread Adam Mackler
On Thu, Jul 31, 2014 at 10:03:00AM -0400, Tom Lane wrote: 2. text is the preferred type among the string class, so any case where you have text on one side and some other string type on the other is going to get resolved as text vs text. Because of #1, domain-specific functions and operators

Re: [GENERAL] Very Limited Toast Compression on JSONB (9.4 beta 2)

2014-08-01 Thread Larry White
On Fri, Aug 1, 2014 at 2:20 AM, Jeff Janes jeff.ja...@gmail.com wrote: On Thursday, July 31, 2014, Larry White ljw1...@gmail.com wrote: Hi, I'm running an experiment on 9.4 beta 2. I put 275,000 identical JSON files into a table using JSONB (one per row). Each raw text file is 251K in

[GENERAL] Re: Is it possible to create an index without keeping the indexed data in a column?

2014-08-01 Thread David G Johnston
Amit Langote wrote On Fri, Aug 1, 2014 at 2:50 PM, Amit Langote lt; amitlangote09@ gt; wrote: Not sure exactly if it applies here; Re-reading the OP again, perhaps it doesn't. Sorry about the noise This is a functional index which lets you store derived data in the index without having

[GENERAL] Re: Is it possible to create an index without keeping the indexed data in a column?

2014-08-01 Thread David G Johnston
larrry wrote Hi, I would like to create a GIN index on a set of JSON documents. Right now I'm storing the data in a JSONB column. The current index looks like this: CREATE INDEX document_payload_idx ON document USING gin (payload jsonb_path_ops); The index is pretty small, but

Re: [GENERAL] How to implement a uniqueness constraint across multiple tables?

2014-08-01 Thread Pujol Mathieu
Le 31/07/2014 20:38, Kynn Jones a écrit : I want to implement something akin to OO inheritance among DB tables. The idea is to define some superclass table, e.g.: CREATE TABLE super ( super_id INT PRIMARY KEY, ... -- other columns ); CREATE TABLE sub_1 (

[GENERAL] Re: How to implement a uniqueness constraint across multiple tables?

2014-08-01 Thread David G Johnston
Pujol Mathieu wrote Le 31/07/2014 20:38, Kynn Jones a écrit : I want to implement something akin to OO inheritance among DB tables. The idea is to define some superclass table, e.g.: (BTW, one could use PostgreSQL built-in support for table inheritance to implement something very much

[GENERAL] Re: User-defined operator function: what parameter type to use for uncast character string?

2014-08-01 Thread David G Johnston
On Thursday, July 31, 2014, Adam Mackler-5 [via PostgreSQL] ml-node+s1045698n5813494...@n5.nabble.com javascript:_e(%7B%7D,'cvml','ml-node%2bs1045698n5813494...@n5.nabble.com'); wrote: On Thu, Jul 31, 2014 at 10:03:00AM -0400, Tom Lane wrote: 2. text is the preferred type among the string

Re: [GENERAL] Re: How to implement a uniqueness constraint across multiple tables?

2014-08-01 Thread Pujol Mathieu
Le 01/08/2014 09:28, David G Johnston a écrit : Pujol Mathieu wrote Le 31/07/2014 20:38, Kynn Jones a écrit : I want to implement something akin to OO inheritance among DB tables. The idea is to define some superclass table, e.g.: (BTW, one could use PostgreSQL built-in support for table

Re: [GENERAL] How to implement a uniqueness constraint across multiple tables?

2014-08-01 Thread Alban Hertroys
On 31 Jul 2014, at 20:38, Kynn Jones kyn...@gmail.com wrote: I want to implement something akin to OO inheritance among DB tables. The idea is to define some superclass table, e.g.: CREATE TABLE super ( super_id INT PRIMARY KEY, ... -- other columns );

Re: [GENERAL] How to implement a uniqueness constraint across multiple tables?

2014-08-01 Thread Kynn Jones
On Thu, Jul 31, 2014 at 3:19 PM, Rob Sargent robjsarg...@gmail.com wrote: Wouldn't this be a problem only if new subn() could/would re-use an id? if new sub() generates a unique id, there would be no chance of two subn entries having the same id. I'd thought that the ids of the sub_k tables

Re: [GENERAL] How to implement a uniqueness constraint across multiple tables?

2014-08-01 Thread Kynn Jones
On Thu, Jul 31, 2014 at 3:52 PM, Kevin Grittner kgri...@ymail.com wrote: This goes beyond the capabilities of declarative constraints to enforce. You can enforce it using triggers, but you need to handle race conditions, which is not easy with MVCC behavior (where reads don't block anything

Re: [GENERAL] Re: Is it possible to create an index without keeping the indexed data in a column?

2014-08-01 Thread Larry White
Thank you David and Amit. This is more or less what I was looking for. I _think_ I might be able to store the data as TEXT, which is highly compressed by Toast, and then perhaps write the function in terms of a TEXT to JSONB conversion. I will give it a try. It might perform terribly, but will

Re: [GENERAL] Very Limited Toast Compression on JSONB (9.4 beta 2)

2014-08-01 Thread Larry White
There is no TOAST compression on JSON or JSONB data in 9.4 beta 2. I'm not sure about other versions. I'm also not sure if this is a bug or by design, but if it is by design, I think the documentation should be updated. Here is a summary of my results inserting 10,000 highly compressible JSON

[GENERAL] Feature proposal and discussion: full-fledged column/function equivalence

2014-08-01 Thread Chris Travers
Hi all; I had a pleasant surprise today when demonstrating a previous misfeature in PostgreSQL behaved unexpectedly. In further investigation, there is a really interesting syntax which is very helpful for some things I had not known about. Consider the following: CREATE TABLE keyvaltest (

[GENERAL] jsonb creation functions?

2014-08-01 Thread Larry White
There is a set of creation functions for json, such as: to_json(anyelement) There doesn't seem to be any equivalent functions for converting text to jsonb. Is there a way to do this? Thanks.

Re: [GENERAL] Re: User-defined operator function: what parameter type to use for uncast character string?

2014-08-01 Thread Tom Lane
Adam Mackler pgsql-gene...@mackler.org writes: One final question: the 'CREATE CAST' command got my interest. I'm assuming that when the docs say it 'performs a conversion between two data types,' that the meaning of data type includes only those created using 'CREATE TYPE' and excludes

Re: [GENERAL] Feature proposal and discussion: full-fledged column/function equivalence

2014-08-01 Thread Vik Fearing
On 08/01/2014 04:57 PM, Chris Travers wrote: Hi all; I had a pleasant surprise today when demonstrating a previous misfeature in PostgreSQL behaved unexpectedly. In further investigation, there is a really interesting syntax which is very helpful for some things I had not known about.

Re: [GENERAL] Feature proposal and discussion: full-fledged column/function equivalence

2014-08-01 Thread Vik Fearing
On 08/01/2014 06:28 PM, Vik Fearing wrote: So with all this in mind, is there any reason why we can't or shouldn't allow: CREATE testfunction(test) returns int language sql as $$ select 1; $$; SELECT testfunction FROM test; That would allow first-class calculated columns. I

Re: [GENERAL] Very Limited Toast Compression on JSONB (9.4 beta 2)

2014-08-01 Thread Jeff Janes
On Thu, Jul 31, 2014 at 11:36 PM, Larry White ljw1...@gmail.com wrote: On Fri, Aug 1, 2014 at 2:20 AM, Jeff Janes jeff.ja...@gmail.com wrote: On Thursday, July 31, 2014, Larry White ljw1...@gmail.com wrote: Hi, I'm running an experiment on 9.4 beta 2. I put 275,000 identical JSON files

Re: [GENERAL] jsonb creation functions?

2014-08-01 Thread Christoph Moench-Tegeder
Hi, There is a set of creation functions for json, such as: to_json(anyelement) There doesn't seem to be any equivalent functions for converting text to jsonb. Is there a way to do this? You can always cast json to jsonb: test_db=# create table t (a integer primary key, b jsonb);

Re: [GENERAL] Very Limited Toast Compression on JSONB (9.4 beta 2)

2014-08-01 Thread Larry White
Jeff, Thank you for your help. This is a Postgres bug, but I don't think I'd have figured it out without your help. What is happening is that if PG can, after compression, put the entire 'document' into one row/page in the toast table it does. However, if the document is too big to fit in one

Re: [GENERAL] Very Limited Toast Compression on JSONB (9.4 beta 2)

2014-08-01 Thread Larry White
Reported as bug #11109. On Fri, Aug 1, 2014 at 1:46 PM, Larry White ljw1...@gmail.com wrote: Jeff, Thank you for your help. This is a Postgres bug, but I don't think I'd have figured it out without your help. What is happening is that if PG can, after compression, put the entire

[GENERAL] Re: Feature proposal and discussion: full-fledged column/function equivalence

2014-08-01 Thread David G Johnston
Vik Fearing wrote CREATE testfunction(test) returns int language sql as $$ select 1; $$; SELECT testfunction FROM test; That would allow first-class calculated columns. I assume the work is mostly at the parser/grammatical level. Is there any reason why supporting that would be a bad

Re: [GENERAL] Re: Feature proposal and discussion: full-fledged column/function equivalence

2014-08-01 Thread Chris Travers
On Fri, Aug 1, 2014 at 12:19 PM, David G Johnston david.g.johns...@gmail.com wrote: Vik Fearing wrote CREATE testfunction(test) returns int language sql as $$ select 1; $$; SELECT testfunction FROM test; That would allow first-class calculated columns. I assume the work is mostly at

Re: [GENERAL] Upgrading from 9.0.11 to 9.3.5 on CentOS 6 (64 bit)

2014-08-01 Thread Phoenix Kiula
Thank you John. you can upgrade to 9.0.18 painlessly. 9.1 or .2 or .3, not quite so painless. What's the best way to get to 9.0.18, as a start? Is there a simple single command I can use? I'm on CentOS 6, 64bit. have you tried a vacuum full of the whole cluster, with your applications

Re: [GENERAL] Upgrading from 9.0.11 to 9.3.5 on CentOS 6 (64 bit)

2014-08-01 Thread John R Pierce
On 8/1/2014 6:31 PM, Phoenix Kiula wrote: What's the best way to get to 9.0.18, as a start? Is there a simple single command I can use? I'm on CentOS 6, 64bit. assuming you installed 9.0 from the yum.postgresql.com respositories, then, `yum update postgresql90-server` and restart the

Re: [GENERAL] Re: Feature proposal and discussion: full-fledged column/function equivalence

2014-08-01 Thread David Johnston
On Fri, Aug 1, 2014 at 6:22 PM, Chris Travers chris.trav...@gmail.com wrote: On Fri, Aug 1, 2014 at 12:19 PM, David G Johnston david.g.johns...@gmail.com wrote: Vik Fearing wrote CREATE testfunction(test) returns int language sql as $$ select 1; $$; SELECT testfunction FROM test;