Re: [GENERAL] Git host for postgresql related projects

2013-04-14 Thread Sumit Raja
Assembla does free git repositories as well http://www.assembla.com/


On 14 April 2013 05:22, Francisco Figueiredo Jr. wrote:

>
> Hi, Magnus!
>
> How you doing?
>
>
> Today I have a "mirror" at github which I'm using to test and learn git
> and it seems to be very good. Git is very powerful and it is easy to
> understand why many are working on it.
>
> Thanks for your help and advice on this subject.
>
>
>
> On Sat, Apr 13, 2013 at 4:12 PM, Magnus Hagander wrote:
>
>> On Sat, Apr 13, 2013 at 9:10 PM, Francisco Figueiredo Jr.
>>  wrote:
>> >
>> > Hi all!
>> >
>> >
>> > I was thinking about moving Npgsql from cvs to another SCM. Possibly
>> git.
>> >
>> > I'd like to know if there is any postgresql project host which supports
>> git
>> > which you could recommend.
>> >
>> > I know there is git.postgresql.org and github.
>> >
>> > From the new repository page of git.postgresql.org it says: "[...] If
>> you
>> > want to to use git, while also getting some of the features that are on
>> > pgfoundry, we strongly advise you to look at github. [...]"
>> >
>> > It would be better for me, then, to use github? As this clearly is my
>> case.
>> >
>> > Thanks in advance for your help and advice.
>>
>> I would suggest going with github. They provide you with a bunch of
>> services like a wiki and an issue tracker that you will not get from
>> git.postgesql.org. They also provide you with the "social coding"
>> stuff or whatever they call it (their forking/pull request/whatnot
>> stuff) if you like it - but you can also just use it as a pure git
>> repo if you prefer.
>>
>> --
>>  Magnus Hagander
>>  Me: http://www.hagander.net/
>>  Work: http://www.redpill-linpro.com/
>>
>
>
>
> --
> Regards,
>
> Francisco Figueiredo Jr.
> Npgsql Lead Developer
> http://www.npgsql.org
> http://gplus.to/franciscojunior
> http://fxjr.blogspot.com
> http://twitter.com/franciscojunior
>



-- 
Raja Consulting Ltd.
Incorporated in England and Wales No. 06454814,  Registered Office: 4
Calder Court, Shorebury Point, Amy Johnson Way, Blackpool FY4 2RH


[GENERAL] JDBC and array of points

2013-02-22 Thread Sumit Raja
Hi,

I've posted this to the postgis user group as well, but I think the issue
may just be with my inability to understand the explicit casting in 9.2.

I have code that generates a PreparedStatement that accepts an array of
points in an ANY clause. I convert the point objects in java to a string
"POINT(lon,lat)" and use this in the createArrayOf JDBC method.

Unfortunately this doesn't work any more (used to work on 9.1 + 1.5). The
statement generated is

{"POINT (51.495727 -0.247342)","POINT (1.495727 52.247342)","POINT
(51.495727 -34.247342)"}

 which results in "ERROR:  malformed array literal".

How can I fix this issue? In psql using the ARRAY[] operator with relevant
casting seems to work (SELECT ARRAY['POINT(-71.064544
42.28787)'::geography]) but as JDBC uses the {} operator I can't see how to
make this work.

Any one have any ideas?

Thanks

Sumit


Re: [GENERAL] Best method to compare subdomains

2013-01-17 Thread Sumit Raja
On 16 January 2013 20:23, Robert James  wrote:

> Is there a recommended, high performance method to check for subdomains?
>
> Something like:
> - www.google.com is subdomain of google.com
> - ilikegoogle.com is not subdomain of google.com
>
> There are many ways to do this (lowercase and reverse the string,
> append a '.' if not there, append a '%', and do a LIKE).  But I'm
> looking for one that will perform well when the master domain list is
> an indexed field in a table, and when the possible subdomain is either
> an individual value, or a field in a table for a join (potentially
> indexed).
>

Maybe the ltree extension will suit what you are trying to do?
http://www.postgresql.org/docs/9.2/static/ltree.html


[GENERAL] FTS for a controlled vocab

2012-10-10 Thread Sumit Raja
Hello,

I am trying to identify how best to handle the situation where a controlled
vocabulary needs to be searched on using full text search.

I have a list of brand names that have, what FTS deems, blank characters in
them that I need to search against. E.g. (+)people, D&G, 100% Design.

These particular combinations are proving to be difficult so I would like
to do a replacement at index and query time
(+)people, +people -> pluspeople
100% Design -> 100percent Design
D&G, D & G, DG -> DandG

Running these through the default parser means I get a much reduced lexemes
that won't be exact enough.

   alias   |   description   | token |  dictionaries  |  dictionary  |
lexemes
---+-+---++--+-
 asciiword | Word, all ASCII | d | {english_stem} | english_stem | {d}
 blank | Space symbols   | & | {} |  |
 asciiword | Word, all ASCII | g | {english_stem} | english_stem | {g}
(3 rows)

 alias   |   description   | token  |  dictionaries  |  dictionary  |
lexemes
---+-+++--+-
 blank | Space symbols   | (  | {} |  |
 blank | Space symbols   | +) | {} |  |
 asciiword | Word, all ASCII | people | {english_stem} | english_stem |
{peopl}


Can I achieve this with FTS and dictionaries or would I need a custom
parser? Any other ideas on how a search like this could work?

I have considered using the actual text column in the query to try and
match the exact term using ilike and pg_trgm. So for a user query of 'D&G
dresses' the select could be:

select * from test where text_val @@ plainto_tsquery('english','d&g
dresses') and lex ilike'%d&g%';

but there would be some horrible query mangling to find all words that have
the blank tokens and use them in multiple ilike comparisons.

Thanks

Sumit


Re: [GENERAL] db server processes hanging around

2012-06-20 Thread Sumit Raja
Or ask your Java devs to investigate why the shut down does not close
the physical connection properly. Does IDEA claim to shut down Tomcat
but actually it is still running because of a threads not being
cleaned up?

Are you sure this isn't happening during normal operation of the
application? If its bad connection/thread management, something like
this might show up in production.

- Sumit


On 19 June 2012 18:28, Steve Crawford  wrote:
> On 06/19/2012 09:29 AM, Mark Rostron wrote:
>>
>> hi
>>
>> we are running out of database connections.
>>
>> we are using pg 9.0.6 on linux centos 5.7 64bit.
>> we are not using any go-between connection pools such as pgbouncer or
>> pgpool - connections occur directly from client to database.
>> the connection setup on the client (java) is default, only providing
>> (user,password,dbhost,dbname).
>>
>> we have about 10 developers developing java thru IDEA who start/stop the
>> local tomcat server frequently.
>> i have observed that tomcat doesn't disconnect from pg cleanly when they
>> cycle, and the server processes persist for a long time.
>> I have had them reduce their local connection factory pool size to 1 (this
>> helped) and increased our max_connection value to 1000.
>> yet the problem persists.
>>
>> I have noticed that the server processes do die "after some time" - due to
>> inactivity?
>> we are looking for a way to control server processes better than we are
>> doing now.
>>
>> thnx for your time.
>> mr
>>
>>
> I am unaware of any system setting like max_connection_idle_time (though it
> might be a useful addition). I have not had to mess with tcp_keepalive
> settings but you might be able to alter those (perhaps at the OS instead of
> PostgreSQL) to reduce the delay before the backend terminates. But this
> won't work for socket connections.
>
> You could hack together a tailored solution by having cron run a script that
> would query pg_stat_activity for queries equal to "" and with a
> backend_start age greater than whatever you find reasonable and then execute
> pg_terminate_backend() on those PIDs. You could even have a table of
> developer IP addresses and only terminate those processes. Alternately, if
> Tomcat connected to a different port you could only kill those.
>
> Cheers,
> Steve
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general



-- 
Raja Consulting Ltd.
Incorporated in England and Wales No. 06454814,  Registered Office: 4
Calder Court, Shorebury Point, Amy Johnson Way, Blackpool FY4 2RH

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Postgres 9.0 Streaming Replication and Load Balancing?

2012-05-17 Thread Sumit Raja
Unsure you can achieve this without a read only and a read write
application set up, I've always had RW application servers separate
from RO ones.

You could disable the application connection pool completely and let
pg-pool do the pooling for you (not sure of performance impact, if
any) as the session needs to be terminated after an insert for pg-pool
to load balance correctly (see
http://www.pgpool.net/mediawiki/index.php/FAQ, 5th one down for more
details).

- Sumit


On 16 May 2012 16:34, Paulo Correia  wrote:
> Hello Sumit,
>
> At the given point there are no exceptions since the tests for using
> pgPool-II with the application using a master and a slave resulted in all
> connections being done on the master and none on the slave.
>
> As the application as it's own connection pool, eventually all connections
> will have a RW operation and as so all these connections will be linked to
> the master.
>
> As so, I cannot benefit from load balancing since all my connections will be
> redirected to the master by pgPool-II, even if they are RO.
>
> Is it possible to have pgPool-II making only load balance with no connection
> pool?
>
> Best regards,
> Paulo Correia
>
> On 15/05/12 09:01, Sumit Raja wrote:
>>
>> On 14 May 2012 17:28, Paulo Correia  wrote:
>>>
>>> Hello all!
>>> Having a Postgres 9.0 with assynchronous streaming replication to a
>>> hot-standby slave, both with CentOs 5.6, how can I use both DB instances
>>> for
>>> query load balancing?
>>> I've tried with pgPool-II but the pooling mechanism is disruptive with
>>> the
>>> existing pool on the application servers.
>>
>> Is the application RW or read only? What is the disruption being
>> caused? Are you seeing specific exceptions?
>>
>> - Sumit
>>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general



-- 
Raja Consulting Ltd.
Incorporated in England and Wales No. 06454814,  Registered Office: 4
Calder Court, Shorebury Point, Amy Johnson Way, Blackpool FY4 2RH

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Postgres 9.0 Streaming Replication and Load Balancing?

2012-05-15 Thread Sumit Raja
On 14 May 2012 17:28, Paulo Correia  wrote:
> Hello all!

> Having a Postgres 9.0 with assynchronous streaming replication to a
> hot-standby slave, both with CentOs 5.6, how can I use both DB instances for
> query load balancing?
> I've tried with pgPool-II but the pooling mechanism is disruptive with the
> existing pool on the application servers.

Is the application RW or read only? What is the disruption being
caused? Are you seeing specific exceptions?

- Sumit

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Which Java persistence library would you use with PostgreSQL?

2012-05-02 Thread Sumit Raja
>  value="jdbc:postgresql://localhost:5432/MySampleDb"/>
>
> If you add ";create=true" just as in the example above, it breaks the code
> and you get this as a result:
>
> org.postgresql.util.PSQLException: FATAL: database "MySampleDb;create=true"
> does not exist

"create=true" is a Derby specific instruction to create the database
if it is missing., it means nothing to the Postgres driver which
rightly assumes it is the name of the database you are trying to
connect to. To create tables using Hibernate you need to set up your
Hibernate config to create the schema for you. The Hibernate docs will
give you more information - for 3.x have a look at
http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/session-configuration.html#configuration-optional.

If that doesn't help, maybe the Hibernate user group is better placed
to give you more information?

- Sumit

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general