Re: [GENERAL] type aliases

2014-02-15 Thread Behrang Saeedzadeh
You probably should define your domain like this: CREATE DOMAIN myvarchar varchar(42); Best regards, Behrang http://www.behrang.org On Sat, Feb 15, 2014 at 6:23 PM, James Harper wrote: > I can create an alias of a type like: > > CREATE DOMAIN myvarchar varchar; > > But I can't declare a my

Re: [GENERAL] type aliases

2014-02-15 Thread James Harper
> > You probably should define your domain like this: > >CREATE DOMAIN myvarchar varchar(42); > That's what I thought, so it won't do what I want. I need to be able to set the length at the time of declaration. So suppose I wanted to implement myvarchar in C. In my _in function, how do I

[GENERAL] Will modifications to unlogged tables also be flused to disk?

2014-02-15 Thread Clemens Eisserer
Hi, I would like to use postgresql's unlogged tables on an embedded system to avoid frequent writes to flash memory. While documentation clearly states that unlogged tables don't have to go through the WAL, it doesn't mention what happens to the data when it is written directly to the database. W

Re: [GENERAL] Will modifications to unlogged tables also be flused to disk?

2014-02-15 Thread Andreas Kretschmer
Clemens Eisserer wrote: > Hi, > > I would like to use postgresql's unlogged tables on an embedded system > to avoid frequent writes to flash memory. > While documentation clearly states that unlogged tables don't have to > go through the WAL, it doesn't mention what happens to the data when > it

Re: [GENERAL] Will modifications to unlogged tables also be flused to disk?

2014-02-15 Thread Clemens Eisserer
Hi Andreas, > They will lost after a crash, but after a regular shutdown / restart all > data in the table. Yes, the semantics are clearly stated in the documentation. What I wonder is whether postgresql will issue flush/fsync operations when unlogged tables are modified? Regards, Clemens --

Re: [GENERAL] Will modifications to unlogged tables also be flused to disk?

2014-02-15 Thread Vik Fearing
On 02/15/2014 12:22 PM, Clemens Eisserer wrote: > Hi Andreas, > >> They will lost after a crash, but after a regular shutdown / restart all >> data in the table. > Yes, the semantics are clearly stated in the documentation. > What I wonder is whether postgresql will issue flush/fsync operations > w

Re: [GENERAL] Will modifications to unlogged tables also be flused to disk?

2014-02-15 Thread Clemens Eisserer
Hi Vik, > Yes. The only difference between logged and unlogged tables is the lack > of WAL. As long as there's no crash, unlogged tables are treated the > same as logged tables as far as flushing/fsync-ing is concerned. Ok thats really bad news :/ After reading the discussion about calling unlo

Re: [GENERAL] Will modifications to unlogged tables also be flused to disk?

2014-02-15 Thread Andres Freund
Hi, On 2014-02-15 12:22:56 +0100, Clemens Eisserer wrote: > > They will lost after a crash, but after a regular shutdown / restart all > > data in the table. > > Yes, the semantics are clearly stated in the documentation. > What I wonder is whether postgresql will issue flush/fsync operations > w

Re: [GENERAL] Will modifications to unlogged tables also be flused to disk?

2014-02-15 Thread Luca Ferrari
On Sat, Feb 15, 2014 at 12:38 PM, Clemens Eisserer wrote: > Ok thats really bad news :/ > After reading the discussion about calling unlogged tables "in memory" > or "cached" I actually had high hopes pgql would take advantage of the > fact that data of unlogged tables are not preserved at recover

Re: [GENERAL] Will modifications to unlogged tables also be flused to disk?

2014-02-15 Thread Clemens Eisserer
Hi Andres, > No fsyncs will be issued in the common paths, and they won't be written > to disk by !shutdown checkpoints. But they *will* be written to disk if > there's not enough space in shared_buffers for all the data. With unlogged tables I still see data written to the device every 10 second

Re: [GENERAL] type aliases

2014-02-15 Thread David Johnston
James Harper wrote >> >> You probably should define your domain like this: >> >>CREATE DOMAIN myvarchar varchar(42); >> > > That's what I thought, so it won't do what I want. I need to be able to > set the length at the time of declaration. > > So suppose I wanted to implement myvarchar in

Re: [GENERAL] type aliases

2014-02-15 Thread Tom Lane
David Johnston writes: > James Harper wrote >> So suppose I wanted to implement myvarchar in C. In my _in function, how >> do I know how big my column declaration is? Eg if someone tries to insert >> 50 characters into my 42 character field, how do I get the declared length >> and then tell postgr

Re: [GENERAL] Restore postgresql data directory to tablespace on new host? Or swap tablespaces?

2014-02-15 Thread Antman, Jason (CMG-Atlanta)
I also asked this question on dba.stackexchange.com, where it received a very detailed enumeration of the associated problems from Craig Ringer: http://dba.stackexchange.com/questions/58896/restore-postgres-data-tablespace-to-new-tablespace-at-new-mount-point/58967?noredirect=1#58967 Perhaps ther

Re: [GENERAL] Restore postgresql data directory to tablespace on new host? Or swap tablespaces?

2014-02-15 Thread Tom Lane
"Antman, Jason (CMG-Atlanta)" writes: > Perhaps there's a postgres internals expert around, someone intimitely > familiar with pg_xlog/pg_clog/pg_control, who can comment on whether it's > possible to take the on-disk files from a single database in a single > tablespace, and make them usable b

Re: [GENERAL] Restore postgresql data directory to tablespace on new host? Or swap tablespaces?

2014-02-15 Thread John R Pierce
On 2/15/2014 10:15 AM, Antman, Jason (CMG-Atlanta) wrote: I also asked this question on dba.stackexchange.com, where it received a very detailed enumeration of the associated problems from Craig Ringer: http://dba.stackexchange.com/questions/58896/restore-postgres-data-tablespace-to-new-tablespa

Re: [GENERAL] Restore postgresql data directory to tablespace on new host? Or swap tablespaces?

2014-02-15 Thread Antman, Jason (CMG-Atlanta)
Well thanks for someone at least sending a reply, though I suppose I should have asked "how do I do this", or "what are the major hurdles to doing this", as it obviously has to be *possible* given unlimited knowledge, resources and time. Perhaps I should frame the question differently: If you

Re: [GENERAL] Restore postgresql data directory to tablespace on new host? Or swap tablespaces?

2014-02-15 Thread Karsten Hilbert
On Sat, Feb 15, 2014 at 06:15:04PM +, Antman, Jason (CMG-Atlanta) wrote: > I also asked this question on dba.stackexchange.com, where it received a very > detailed enumeration of the associated problems from Craig Ringer: ... > Perhaps there's a postgres internals expert around, someone > i

Re: [GENERAL] Restore postgresql data directory to tablespace on new host? Or swap tablespaces?

2014-02-15 Thread John R Pierce
On 2/15/2014 10:31 AM, Antman, Jason (CMG-Atlanta) wrote: If you had a single ~1TB database, and needed to be able to give fresh data copies to dev/test environments (which are usually largely idle) either on demand or daily, how would you do it? The only other thing that comes to mind is separat

Re: [GENERAL] Restore postgresql data directory to tablespace on new host? Or swap tablespaces?

2014-02-15 Thread Antman, Jason (CMG-Atlanta)
On 02/15/2014 01:22 PM, John R Pierce wrote: > On 2/15/2014 10:15 AM, Antman, Jason (CMG-Atlanta) wrote: >> I also asked this question on dba.stackexchange.com, where it >> received a very detailed enumeration of the associated problems from >> Craig Ringer: >> http://dba.stackexchange.com/questi

Re: [GENERAL] Is it reasonable to store double[] arrays of 30K elements

2014-02-15 Thread AlexK
Hi Pavel, 1. I believe we have lots of memory. How much is needed to read one array of 30K float number? 2. What do we need to avoid possible repeated detost, and what it is? 3. We are not going to update individual elements of the arrays. We might occasionally replace the whole thing. When we ben

Re: [GENERAL] Is it reasonable to store double[] arrays of 30K elements

2014-02-15 Thread Pavel Stehule
2014-02-15 21:52 GMT+01:00 AlexK : > Hi Pavel, > > 1. I believe we have lots of memory. How much is needed to read one array > of 30K float number? > it is not too much - about 120KB > 2. What do we need to avoid possible repeated detost, and what it is? > any access to array emits detoast - s

Re: [GENERAL] Restore postgresql data directory to tablespace on new host? Or swap tablespaces?

2014-02-15 Thread Adrian Klaver
On 02/15/2014 10:31 AM, Antman, Jason (CMG-Atlanta) wrote: Well thanks for someone at least sending a reply, though I suppose I should have asked "how do I do this", or "what are the major hurdles to doing this", as it obviously has to be *possible* given unlimited knowledge, resources and time.

Re: [GENERAL] Restore postgresql data directory to tablespace on new host? Or swap tablespaces?

2014-02-15 Thread Antman, Jason (CMG-Atlanta)
On 02/15/2014 02:00 PM, Francisco Olarte wrote: > Hi: > > On Sat, Feb 15, 2014 at 7:31 PM, Antman, Jason (CMG-Atlanta) > wrote: >> Well thanks for someone at least sending a reply, though I suppose I >> should have asked "how do I do this", or "what are the major hurdles to >> doing this", as it o

Re: [GENERAL] Restore postgresql data directory to tablespace on new host? Or swap tablespaces?

2014-02-15 Thread Antman, Jason (CMG-Atlanta)
Replies inline below. Thanks to everyone who's responded so far. The more I explain this, and answer questions, the more I see how my original "brilliant" idea (multiple DBs per postgres instance on one host, instead of 1:1:1 DB:postgres:host) is insane, without some specific support for it in

Fwd: Re: [GENERAL] Restore postgresql data directory to tablespace on new host? Or swap tablespaces?

2014-02-15 Thread Adrian Klaver
Forwarding back to list. Original Message Subject: Re: [GENERAL] Restore postgresql data directory to tablespace on new host? Or swap tablespaces? Date: Sat, 15 Feb 2014 22:08:51 + From: Antman, Jason (CMG-Atlanta) To: Adrian Klaver Replies inline below. Thanks to eve

Re: [GENERAL] Restore postgresql data directory to tablespace on new host? Or swap tablespaces?

2014-02-15 Thread Karsten Hilbert
On Sat, Feb 15, 2014 at 10:17:05PM +, Antman, Jason (CMG-Atlanta) wrote: > [...] I see how my original "brilliant" idea > (multiple DBs per postgres instance on one host, [...]) is insane, > without some specific support for it in postgres. "multiple DBs per PostgreSQL instance on one host"

Re: [GENERAL] designing time dimension for star schema

2014-02-15 Thread Mark Wong
On Mon, Feb 10, 2014 at 8:45 AM, Mark Wong wrote: > Hello everybody, > > I was wondering if anyone had any experiences they can share when > designing the time dimension for a star schema and the like. I'm > curious about how well it would work to use a timestamp for the > attribute key, as oppos

Re: [GENERAL] Restore postgresql data directory to tablespace on new host? Or swap tablespaces?

2014-02-15 Thread Antman, Jason (CMG-Atlanta)
On 02/15/2014 05:27 PM, Karsten Hilbert wrote: > On Sat, Feb 15, 2014 at 10:17:05PM +, Antman, Jason (CMG-Atlanta) wrote: > >> [...] I see how my original "brilliant" idea >> (multiple DBs per postgres instance on one host, [...]) is insane, >> without some specific support for it in postgres.

Re: [GENERAL] Restore postgresql data directory to tablespace on new host? Or swap tablespaces?

2014-02-15 Thread Antman, Jason (CMG-Atlanta)
On 02/15/2014 04:55 PM, Antman, Jason (CMG-Atlanta) wrote: > On 02/15/2014 02:00 PM, Francisco Olarte wrote: >> >> If I NEEDED to be able to provide 100-150 snapshots to test/dev >> environments 20% of which maybe active, I'll setup a cluster, buy >> somewhere above a quarter terabyte RAM and some

Re: [GENERAL] Restore postgresql data directory to tablespace on new host? Or swap tablespaces?

2014-02-15 Thread John R Pierce
On 2/15/2014 4:30 PM, Antman, Jason (CMG-Atlanta) wrote: My current postgres instances for testing have 16GB shared_buffers (and 5MB work_mem, 24GB effective_cache_size). So if, hypothetically (to give a mathematically simple example), I have a host machine with 100GB RAM, I can't run 10 postgres