Re: [GENERAL] Optimizing a read-only database

2015-05-20 Thread Sameer Thakur
Hello, In addition to what has already been suggested 1. Use VACUUM FREEZE ANALYZE; Otherwise you will still have some trickle of write-activity going on, not always efficiently, despite being in read-only mode. It's because of what's referred to as Hint Bits: http://wiki.postgresql.or

Re: [GENERAL] Optimizing a read-only database

2015-05-20 Thread Sameer Thakur
Hello >That is bad advice. >If there are no writes, fsync won't hurt anyway. >Never disable fsync for anything but test systems. Yep. Its a bad way to speed up writes. Not relevant to this context and bad anyway regards Sameer -- View this message in context: http://postgresql.nabble.com/Op

Re: [GENERAL] Optimizing a read-only database

2015-05-20 Thread Sameer Thakur
Hello, >I was more dreaming of something like "disable read write locks or >mutexes" when accessing the database in read-only mode, but sadly this >case seems unhandled. You could use transactions in read only mode. They do not generate XID's,which reduces the need to do VACUUM to protect agai

Re: [GENERAL] Optimizing a read-only database

2015-05-20 Thread Sameer Thakur
Hello, You could disable fsync as write reliability is not relevant regards Sameer -- View this message in context: http://postgresql.nabble.com/Optimizing-a-read-only-database-tp5849746p5850103.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-gen

Re: [GENERAL] pg_xlog Concern

2015-05-20 Thread Sameer Thakur
Hello, >First: When I have given checkpoint segments=200 (As per my knowledge WAL file should be generated >200*2+3=403 only) but why it’s generating too much file. MY each WAL file is 16 MB. The formula is (2 + checkpoint_completion_target) * checkpoint_segments + 1 or checkpoint_segments + wal

[GENERAL] Merge requirements between offline clients and central database

2014-09-04 Thread Sameer Thakur
Hello, As part of database evaluation one key requirements is as follows: 1. There are multiple thick clients (say 20 ~ 100) with their local databases accepting updates 2. They sync data with a central database which can also receive updates itself. 3. They may not be connected to central databa

Re: [GENERAL] Using fmgr_hook

2014-08-26 Thread Sameer Thakur
Hello, > Try like this: > - connect with psql > - call your custom_fmgr_hook > - attach to the backend with gdb > - set the breakpoint > - call custom_fmgr_hook again I tried to check in a different way, by just using log statements to see if customs* hook functions ever get executed. They were no

Re: [GENERAL] Using fmgr_hook

2014-08-25 Thread Sameer Thakur
Hello, Thank you for responding >My experience is that you cannot set breakpoints before the library >is loaded, so you first have to call a function in the library, then >you interrupt and set the breakpoint. I tried to do the following 1. Execute Postgres (now auto_explain is loaded) 2. Start a p

[GENERAL] Using fmgr_hook

2014-08-25 Thread Sameer Thakur
Hello, In the process of implementing my own version of sysdate, i was trying to use the fmgr_hook. I had a look at the sepgsql contrib module and tried to do the same by modifying auto_explain just to test using fmgr_hook. My code changes are: static needs_fmgr_hook_type prev_needs_fmgr_hook = N

Re: [GENERAL] Mimicking Oracle SYSDATE

2014-08-19 Thread Sameer Thakur
Sameer On Tue, Aug 19, 2014 at 8:21 PM, Tom Lane wrote: > Sameer Thakur writes: >> We are thinking of building our own version of Oracle's sysdate, in >> the form of PostgreSQL extension. >> Consider the behavior of sysdate for multiple inserts inside a function > &

[GENERAL] Mimicking Oracle SYSDATE

2014-08-19 Thread Sameer Thakur
Hello, We are thinking of building our own version of Oracle's sysdate, in the form of PostgreSQL extension. Consider the behavior of sysdate for multiple inserts inside a function CREATE OR REPLACE FUNCTION fun2 RETURN number IS var1 number(10); var2 number (2); BEGIN insert into t1 select

Re: [GENERAL] Stored Procedure table/column args

2013-09-08 Thread Sameer Thakur
Hello, Create a view as described @ http://www.postgresql.org/message-id/flat/3c055b7e.bb52f...@but.auc.dk#3c055b7e.bb52f...@but.auc.dk create view my_tbldescription as select u.usename, t.typname AS tblname, a.attname, a.atttypid, n.typname AS atttypname, int4larger(a.attlen, a.atttypmod

Re: [GENERAL] Self referencing composite datatype

2013-08-07 Thread Sameer Thakur
> > On Wed, Aug 7, 2013 at 4:57 AM, Sameer Thakur wrote: > >> Hello, >> I wanted to create a composite datatype to represent a Node. So it would >> have a few attributes and an array of type Node which is the children of >> this node. >> create type Node

[GENERAL] Self referencing composite datatype

2013-08-07 Thread Sameer Thakur
Hello, I wanted to create a composite datatype to represent a Node. So it would have a few attributes and an array of type Node which is the children of this node. create type Node as (r integer, s integer, children Node []); But i get error type Node[] does not exist. I understand that Node is not

Re: [GENERAL] Populating array of composite datatype

2013-08-07 Thread Sameer Thakur
Thank you Raghavendra and Chris, both approaches work.

[GENERAL] Populating array of composite datatype

2013-08-07 Thread Sameer Thakur
Hello, I have a composite datatype abc which has two integer fields x,y. I have a table Test which has an array of abc. I am trying to populate Test. Tried insert into test values (ARRAY[abc(1,2)]); but got error ERROR: function abc(integer, integer) does not exist Is there anyway for doing this?

Re: [GENERAL] Archiving and recovering pg_stat_tmp

2013-06-26 Thread Sameer Thakur
> > >> >Do you think that it is important to do so? Are you experiencing > problems which you believe are due to missing/out of date >activity > statistics? Or is this more for curiosity? > I am making specifications for a tool which captures query plan > statistics. I wanted its behavior to be t

Re: [GENERAL] Archiving and recovering pg_stat_tmp

2013-06-25 Thread Sameer Thakur
> > > > I did the following > > 1. Enabled archiving > > 2. Executed SQL's 3. Shutdown 4. copied data directory (including the > > pgstats.stat under global) and archive directory under backup/1 > > repeated 2,3,4 once more > > So now i have 2 backup directories. > > Now i created recovery.conf und

Re: [GENERAL] Archiving and recovering pg_stat_tmp

2013-06-25 Thread Sameer Thakur
>>But, if you do PITR using the same directory (which I haven't), I >>think you would need to somehow replace the stats with the ones you >>want, may be from your backup of the same (that is, of >>pg_stat/*.stat), though I am not sure if that would be correct. I >>doubt if WAL replay (as in a consi

Re: [GENERAL] Archiving and recovering pg_stat_tmp

2013-06-20 Thread Sameer Thakur
On Fri, Jun 21, 2013 at 11:35 AM, Amit Langote wrote: > On Fri, Jun 21, 2013 at 2:44 PM, Sameer Thakur > wrote: > > > >> >"You need to have statistics recovered to the same state as they were > >> >when you took the FS level backup of your data

Re: [GENERAL] Archiving and recovering pg_stat_tmp

2013-06-20 Thread Sameer Thakur
> >"You need to have statistics recovered to the same state as they were > >when you took the FS level backup of your database after shutting down > >the server." > Correct > > >"Shutting down" is important since that is when you would have > >statistics files ($PGDATA/pg_stat/*.stat) availabl

Re: [GENERAL] Archiving and recovering pg_stat_tmp

2013-06-20 Thread Sameer Thakur
>Documentation mentions following: Thanks, but how does this relate to statistics recovery wrt PITR? regards Sameer

[GENERAL] Archiving and recovering pg_stat_tmp

2013-06-19 Thread Sameer Thakur
Hello, I was trying to figure out how does one recover server statistics to the same snapshot to which a database is restored after PITR. The steps i had in mind were 1.Set up WAL archiving 2.On server shutdown one would need to backup pg_stat_tmp along with file system level back of database 3. O