[ADMIN] How to prevent vacuum again and again on the unchanged tables?

2013-05-07 Thread Haifeng Liu
I noticed postgresql would do vacuum to prevent wraparound of the transaction id, and I also tried to use vacuum freeze, I am not quite sure about freeze, but it seems postgresql will still vacuum the frezzed unchanged tables automatically. My scenario is, I have a table with daily partitions,

[ADMIN] Does index based on text with 'en_US.utf8' collation support like query?

2012-12-25 Thread Haifeng Liu
Hi, I found that queries like "select * from tbl where col1 like 'abc%'" will use index only when the col1(and the index) use 'C' collation. If I use 'default' which is 'en_US.utf8' in my database, the equation condition will use the index but like query will not. I also tried to specify the c

[ADMIN] Confuse about the behaveior of PreparedStatement.executeBatch (jdbc)

2012-12-13 Thread Haifeng Liu
Hi, I have a DB writer program written in Java, it do batch updates, and will try to update each record in a batch if it failed. I think no any record in a batch will be update if the batch failed, but weirdly I found a few records update twice(very little amount among all records). Well, the

Re: [ADMIN] how to allow integer overflow for calculating hash code of a string?

2012-10-30 Thread Haifeng Liu
bit(32)) as int4); end; I did some tests which include both positive and negative results, seems all Ok. On Sep 21, 2012, at 11:21 PM, Craig James wrote: > On Thu, Sep 20, 2012 at 7:56 PM, Haifeng Liu wrote: > > On Sep 20, 2012, at 10:34 PM, Craig James wrote: > >> >&

Re: [ADMIN] how to allow integer overflow for calculating hash code of a string?

2012-10-30 Thread Haifeng Liu
bit(32)) as int4); end; I did some tests which include both positive and negative results, seems all Ok. On Sep 21, 2012, at 11:21 PM, Craig James wrote: > On Thu, Sep 20, 2012 at 7:56 PM, Haifeng Liu wrote: > > On Sep 20, 2012, at 10:34 PM, Craig James wrote: > >> >&

Re: [ADMIN] how to allow integer overflow for calculating hash code of a string?

2012-09-20 Thread Haifeng Liu
On Sep 20, 2012, at 10:34 PM, Craig James wrote: > > > On Thu, Sep 20, 2012 at 1:55 AM, Haifeng Liu wrote: > I want to write a hash function which acts as String.hashCode() in java: hash > = hash * 31 + s.charAt(i)... but I got integer out of range error. How can I > avoi

[ADMIN] how to allow integer overflow for calculating hash code of a string?

2012-09-20 Thread Haifeng Liu
I want to write a hash function which acts as String.hashCode() in java: hash = hash * 31 + s.charAt(i)... but I got integer out of range error. How can I avoid this? I saw java do not care overflow of int, it just make the result negative. -- Sent via pgsql-admin mailing list (pgsql-admin@pos

[ADMIN] JDBC keep alive issue

2012-08-09 Thread Haifeng Liu
Hi experts, I have a program running like a daemon, which analyze data and write to postgresql 9.1 on centos 5.8. There is only one connection between my program and the postgresql database, and I hope the connection may keep alive all the time. But I failed, the connection will be reset after

Re: [ADMIN] How to make the row changes inside trigger function visible to the top level sql statement?

2012-08-09 Thread Haifeng Liu
On Aug 9, 2012, at 7:11 PM, Sergey Konoplev wrote: > On Thu, Aug 9, 2012 at 2:53 PM, Sergey Konoplev > wrote: >>> How can I make the row changes inside the trigger function visible to the >>> top level statement? >> >> your redirecting function is okay. However the only way to get the >> ins

[ADMIN] How to make the row changes inside trigger function visible to the top level sql statement?

2012-08-07 Thread haifeng liu
Hello, I am doing table partitioning, all is ok except that after executing 'insert' sql statement I can't get affected rows, it always be 0. After searching on the documents, I found that row changes inside trigger function is not visible to the top level statement. Partition table using a tr

[ADMIN] How to make data changes inside trigger function visible to the top level statement ?

2012-08-06 Thread Haifeng Liu
Hello, I am doing table partitioning, all is ok except that after executing 'insert' sql statement I can't get affected rows, it always be 0. After searching on the documents, I found that row changes inside trigger function is not visible to the top level statement. Partition table using a tr

Re: [ADMIN] Data split -- Creating a copy of database without outage

2012-05-29 Thread Haifeng Liu
Why not use a partitioned table? You can write a trigger to control which partition the coming data should be inserted. Regards, Liu Haifeng Home: http://liuhaifeng.com On May 30, 2012, at 4:13 AM, Igor Shmain wrote: > Can you please help with advice? > > I need to design a solution fo

Re: [ADMIN] Daily Rotated Insertion

2012-03-27 Thread Haifeng Liu
On Mar 27, 2012, at 3:33 PM, Sergey Konoplev wrote: > On Tue, Mar 27, 2012 at 10:02 AM, Haifeng Liu wrote: >> Yes, that's what I am doing. There are many ways to implement partitioned >> table, I just want to find an elegant one. Bulk create a certain number of >> pa

Re: [ADMIN] Daily Rotated Insertion

2012-03-26 Thread Haifeng Liu
On Mar 27, 2012, at 12:42 PM, Sergey Konoplev wrote: > Hi, > > On Mon, Mar 26, 2012 at 9:39 AM, Haifeng Liu wrote: >> Well, I can create a trigger to redirect insertion to 'yesterday', 'today' >> and 'tomorrow', but I am still expecting a m

[ADMIN] Daily Rotated Insertion

2012-03-25 Thread Haifeng Liu
Hi all: I want to do a daily rotated insertion according the data's date field. The data come from a real time analyzer, which means it's date field is nearly the current date but not exactly, even not exactly in the date order. The real trouble is it will be a heavy insertion, I don't want to