[GENERAL] best practice in archiving CDR data

2010-03-29 Thread Juan Backson
Hi, I am using Postgres to store CDR data for voip switches. The data size quickly goes about a few TBs. What I would like to do is to be able to regularly archive the oldest data so only the most recent 6 months of data is available. All those old data will be stored in a format that can be

Re: [GENERAL] best practice in archiving CDR data

2010-03-29 Thread Juan Backson
On Mon, Mar 29, 2010 at 9:33 PM, A. Kretschmer andreas.kretsch...@schollglas.com wrote: In response to Juan Backson : Hi, I am using Postgres to store CDR data for voip switches. The data size quickly goes about a few TBs. What I would like to do is to be able to regularly archive

[GENERAL] pgmemcache vs pgmemcached

2009-11-12 Thread Juan Backson
Hi, Have anyone tried pgmemcache and pgmemcached? What is the difference betweent he two? They are both non-persistent, so I have difficult time deciding which one to use. Any suggestion? Thanks, jb

[GENERAL] question about using pgmemcache

2009-11-08 Thread Juan Backson
Hi, I am planning to pgmemcache to act as a fast-accessible cache before my app and postgres. I have got it pgmemcache setup. The question I have is that if memcached crashes, and I need to restart memcached, since memcached is not persistent, do I need to run some scripts to auto-recreate all

[GENERAL] strange error occurs when adding index

2009-09-04 Thread Juan Backson
Hi, When I tried to add the following index, I get some strange error. Does anyone know what these errors mean and how to fix it? Here is the index query: create index idx_product_items_digits on product_items using gist (digits gist_prefix_range_ops,product_id) Here is the error: NOTICE:

[GENERAL] N + 1 replication

2009-09-03 Thread Juan Backson
Hi, Does anyone know if there is any N + 1 replication for Postgres? Could someone please point me to the right direction? Thanks, JB

Re: [GENERAL] libpq performance

2009-09-03 Thread Juan Backson
Hi, For this problem, what if I use prepared statement? if I use prepared statement directly from libpq, would it help? Thanks, JB On Mon, Aug 24, 2009 at 9:59 AM, Craig Ringer cr...@postnewspapers.com.auwrote: On Mon, 2009-08-24 at 00:08 +0800, Juan Backson wrote: I have a sql that only

[GENERAL] libpq performance

2009-08-23 Thread Juan Backson
Hi, I have a sql that only takes 0.3 ms to run when using psql with explain analyze. However, when I execute it using PQexec, it takes 12ms for PGexec. Does anyone know why it is that slow? My db server is in the internal network, so there should not be any latency issue. Any suggestion will

[GENERAL] how to return field based on field= NULL or not

2009-08-23 Thread Juan Backson
Hi, In my table, I have fieldA and fieldB. At any point in time, only one of these fields can have data in it. The other is NULL. Instead of select fieldA, fieldB from table, I want it to return either fieldA or fieldB depends on whether it is NULL or not. The reason is because I want to use

[GENERAL] Need help with libpq and PQexec

2009-08-11 Thread Juan Backson
Hi, In my source code, I have: res = PQexec(conn,select * from resource); if(PQresultStatus(res) != PGRES_COMMAND_OK){ switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR,PQexec failed:%s\n,PQerrorMessage(conn)); PQclear(res); return NULL; }

Re: [GENERAL] Need help with libpq and PQexec[RESOLVEd]

2009-08-11 Thread Juan Backson
I used if (PQresultStatus(res) != PGRES_TUPLES_OK) and it is fine now. Thanks, JB On Tue, Aug 11, 2009 at 3:35 PM, Juan Backson juanback...@gmail.com wrote: Hi, In my source code, I have: res = PQexec(conn,select * from resource); if(PQresultStatus(res) != PGRES_COMMAND_OK

[GENERAL] keepalive problem with libpg connection

2009-08-11 Thread Juan Backson
Hi, I am writing my own connection pool for libpq's connection. My goal is to try to reduce the amount of time spent in opening and closing socket. However, I see that Postgres would close my connection after every so often. What is the best solution for that? Should I regularly send some

[GENERAL] PQstatus does not seem to work

2009-08-10 Thread Juan Backson
Hi I used PQstatus(conn) function to check connection status, but I found that it still returns CONNECTION_OK even after postgres is restarted. Does anyone know if there is another command that I can use to check connection status? What other solution is available to check whether a connection

Re: [GENERAL] PQstatus does not seem to work

2009-08-10 Thread Juan Backson
at 2:02 AM, Tim Hart tjh...@mac.com wrote: On 8/10/09 12:08 PM, Sam Mason s...@samason.me.uk wrote: On Tue, Aug 11, 2009 at 12:41:47AM +0800, Juan Backson wrote: I used PQstatus(conn) function to check connection status, but I found that it still returns CONNECTION_OK even after postgres