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

2014-07-31 Thread Larry White
On Fri, Aug 1, 2014 at 2:20 AM, Jeff Janes wrote: > On Thursday, July 31, 2014, Larry White 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 uncomp

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

2014-07-31 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 operator

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

2014-07-31 Thread Jeff Janes
On Thursday, July 31, 2014, Larry White > 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 uncompressed is 69GB. The > column storage is set to EXTENDED. The

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

2014-07-31 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" foreve

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

2014-07-31 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? https://www.digitaloce

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

2014-07-31 Thread Amit Langote
On Fri, Aug 1, 2014 at 2:50 PM, Amit Langote 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 subscription: http://www.postgr

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

2014-07-31 Thread Amit Langote
On Fri, Aug 1, 2014 at 10:48 AM, Michael Paquier wrote: > On Fri, Aug 1, 2014 at 4:47 AM, Larry White wrote: >> Is there a way to get Postgres to index the table as if the JSON were there, >> but not actually put the data in the table? >> I could either store the docs >> elsewhere and keep a refe

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

2014-07-31 Thread Larry White
Yes. It was EXTENDED. As a further test, I dropped the table and rebuilt it, explicitly changing the EXTENDED designation to EXTERNAL and got exactly the same size TOAST table. So there was no compression at all with storage set to EXTENDED. On Thu, Jul 31, 2014 at 11:51 PM, Adrian Klaver wrote

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

2014-07-31 Thread Adrian Klaver
On 07/31/2014 01:44 PM, Larry White 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 uncompressed is 69GB. The column storage is set to EXTENDED. There are other toas

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

2014-07-31 Thread Michael Paquier
On Fri, Aug 1, 2014 at 4:47 AM, Larry White wrote: > Is there a way to get Postgres to index the table as if the JSON were there, > but not actually put the data in the table? > I could either store the docs > elsewhere and keep a reference, or compress them and put them in the table > in compress

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

2014-07-31 Thread Larry White
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 uncompressed is 69GB. The column storage is set to EXTENDED. There are other toastable columns in the table, but none have mor

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

2014-07-31 Thread Kevin Grittner
Kynn Jones 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 > >    ); > > >    CREATE TABLE sub_1 ( > >  

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

2014-07-31 Thread Larry White
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 the actual data takes up

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

2014-07-31 Thread Rob Sargent
On 07/31/2014 01:16 PM, Marti Raudsepp wrote: On Thu, Jul 31, 2014 at 9:38 PM, Kynn Jones wrote: Does PostgreSQL have a good way to enforce the uniqueness of super_id values across multiple tables? Well that's easy: no. Regards, Marti That might be a little hasty. There are conditional def

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

2014-07-31 Thread Rob Sargent
On 07/31/2014 12:38 PM, Kynn Jones 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 ); CREATE TABLE sub_1 (

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

2014-07-31 Thread Marti Raudsepp
On Thu, Jul 31, 2014 at 9:38 PM, Kynn Jones wrote: > Does PostgreSQL have a good way to enforce the uniqueness of super_id values > across multiple tables? Well that's easy: no. Regards, Marti -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscr

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

2014-07-31 Thread Kynn Jones
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 ( super_id INT PRIMARY KEY, FOR

Re: [GENERAL] How can I create null value from function call with no results?

2014-07-31 Thread Marc Mamin
> I want to call a function using a column of a table as the parameter and > return the parameter and function results together. > The problem is, when the function returns an empty row my select statement > that uses the function returns an empty row as well. Hello, not sure if it makes sense in

Re: [GENERAL] Postgress Doubts

2014-07-31 Thread Bruce Momjian
On Fri, Jun 6, 2014 at 04:29:59PM +0530, Atri Sharma wrote: > > > > On Fri, Jun 6, 2014 at 4:22 PM, Ravi Kiran wrote: > > Hello, I am Ravikiran, pursuing my third year BITS Pilani, India, I am > doing my thesis in postgress technology, > > The project is about implementing new jo

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

2014-07-31 Thread Tom Lane
David G Johnston writes: > On Thu, Jul 31, 2014 at 12:19 AM, Adam Mackler-5 [via PostgreSQL] < > ml-node+s1045698n5813399...@n5.nabble.com> wrote: >> Can you explain what the abuse is? Also why the "=" operator does not >> work even without the domain? > When you write, explicitly, "domain = tex

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

2014-07-31 Thread Kevin Grittner
Adam Mackler wrote: > CREATE domain my_domain as char(3) check(VALUE similar to '[A-C]{3}'); > CREATE TABLE my_table (val my_domain); > INSERT INTO my_table VALUES ('ABC'); > sandbox=> SELECT * FROM my_table WHERE val='abc'; > val > - > (0 rows) > > Question: What

Re: [GENERAL] String concatenation operator which keeps trailing spaces in CHAR(n) columns

2014-07-31 Thread Andrus
Hi, hm, why do that at all? how about avoid the char() type and create views over tables using rpad when you want space padding: create view v_foo as select *, rpad(f, 50, ' ') as f_padded; I'm creating a converter which converts Visual FoxPro expressions to Postgres at runtime. FoxPro ex

Re: [GENERAL] What query currently running within function

2014-07-31 Thread Merlin Moncure
On Tue, Jul 22, 2014 at 4:36 AM, Rebecca Clarke wrote: > Hi all, > > Presently I'm executing a function that runs many queries within it. > > select * from _myfunction(); > > Is there a way to see what query it is up to within the function? > When I do a select of pg_stat_activity it just shows me

Re: [GENERAL] String concatenation operator which keeps trailing spaces in CHAR(n) columns

2014-07-31 Thread Merlin Moncure
On Wed, Jul 30, 2014 at 5:43 AM, Andrus wrote: > How to create string concatenation operator which preserves trailing spaces > on CHAR(n) type columns ? hm, why do that at all? how about avoid the char() type and create views over tables using rpad when you want space padding: create view v_fo

Re: [GENERAL] Inconsistent results postgresql

2014-07-31 Thread Kevin Grittner
Chris Curvey wrote: > Emir Ibrahimbegovic wrote: >> So looking for same date using different date range I get >> different results, how is this even possible? Can I look at >> something else? I'm really stuck here > Remove the sum (just select "payments.amount") and the GROUP BY > and run your

Re: [GENERAL] Inconsistent results postgresql

2014-07-31 Thread Emir Ibrahimbegovic
Yes there was some users subscribed at different date than payment was made. So I used this to get the results on the daily basis : SELECT date_trunc('day', payments.created_at) "day", SUM("payments"."amount") AS sum_id FROM "payments" INNER JOIN "users" ON "users"."id" = "payments"."user_id" WH

Re: [GENERAL] Inconsistent results postgresql

2014-07-31 Thread Adrian Klaver
On 07/31/2014 05:44 AM, Emir Ibrahimbegovic wrote: Thank you for your response guys. So, did you find the cause? -- Adrian Klaver adrian.kla...@aklaver.com -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/ma

Re: [GENERAL] BDR Postgres

2014-07-31 Thread Adrian Klaver
On 07/30/2014 10:25 PM, Tonny wrote: Hi everyone I read that 2ndQuadrant released bidirectional replication for postgres, know whether this package will enter apt.postgresql.org or if there will be any repository for Debian GNU / Linux? Information is here: http://2ndquadrant.com/en/resourc

Re: [GENERAL] Inconsistent results postgresql

2014-07-31 Thread Emir Ibrahimbegovic
Thank you for your response guys. On Wed, Jul 30, 2014 at 9:25 PM, Chris Curvey wrote: > > > > On Wed, Jul 30, 2014 at 8:41 PM, Emir Ibrahimbegovic < > emir.ibrahimbego...@gmail.com> wrote: > >> Hello all, >> >> I've got two queries which should produce the same results but they don't >> for so

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

2014-07-31 Thread David G Johnston
On Thu, Jul 31, 2014 at 12:19 AM, Adam Mackler-5 [via PostgreSQL] < ml-node+s1045698n5813399...@n5.nabble.com> wrote: > On Wed, Jul 30, 2014 at 10:59:28PM -0700, David G Johnston wrote: > > ISTM that if this was supported you would be doing it correctly. > > Thank you for the quick response. I'm

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

2014-07-31 Thread Adam Mackler
On Wed, Jul 30, 2014 at 10:59:28PM -0700, David G Johnston wrote: > ISTM that if this was supported you would be doing it correctly. Thank you for the quick response. I'm not understanding you. Could you elaborate? > The main problem is you are abusing DOMAIN - which is strictly the > base t