Re: Multithreaded query onto 4 postgresql instances - Mailing list pgsql-general

From Allan Kamau
Subject Re: Multithreaded query onto 4 postgresql instances
Date
Msg-id AANLkTimyQC-UbF4gMyGYbivG3yQG1YC9tRpdQ=7mbNQ_@mail.gmail.com
Whole thread Raw
In response to Re: Multithreaded query onto 4 postgresql instances  (pasman pasmański <pasman.p@gmail.com>)
List pgsql-general
> 2011/2/10, Alessandro Candini <candini@meeo.it>:
>> Here you are my probably uncommon situation.
>>
>> I have installed 4 different instances of postgresql-9.0.2 on the same
>> machine, on ports 5433, 5434, 5435, 5436.
>> On these instances I have splitted a huge database, dividing it per date
>> (from 1995 to 1998 on 5433, from 1999 to 2002 on 5434 and so on...).
>> Then I have developed a C function using libpq which creates 4 threads,
>> each one which query a 1/4 of the db. After that I merge the results in
>> one single response.
>>
>> My function works fine, but I need to include it inside a postgresql
>> instance in order to launch it as a normal SQL query (SELECT myfunc(...);).
>> Why I have to do something tricky like this is long too explain...
>>
>> I have read the documentation here
>> http://www.postgresql.org/docs/9.0/static/xfunc-sql.html#XFUNC-SQL-FUNCTIONS-RETURNING-SET,
>> but I'm pretty confuse and I don't know if this is the right way to
>> accomplish my goal.
>>
>> Have you got any ideas or suggestions?
>>
>> Thanks a lot!
>>
>> --
>> Alessandro Candini
>>
>> MEEO S.r.l.
>> Via Saragat 9
>> I-44122 Ferrara, Italy
>> Tel: +39 0532 1861501
>> Fax: +39 0532 1861637
>> http://www.meeo.it
>>
>> ========================================
>> "ATTENZIONE:le informazioni contenute in questo messaggio sono
>> da considerarsi confidenziali ed il loro utilizzo è riservato unicamente
>> al destinatario sopra indicato. Chi dovesse ricevere questo messaggio
>> per errore è tenuto ad informare il mittente ed a rimuoverlo
>> definitivamente da ogni supporto elettronico o cartaceo."
>>
>> "WARNING:This message contains confidential and/or proprietary
>> information which may be subject to privilege or immunity and which
>> is intended for use of its addressee only. Should you receive this
>> message in error, you are kindly requested to inform the sender and
>> to definitively remove it from any paper or electronic format."
>>
>>
>> --
>> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-general
>>
>
>
> --
> ------------
> pasman
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

2011/2/12 pasman pasmański <pasman.p@gmail.com>:
> I think this is bad idea. Better you use cursors.
>


Instead of splitting a database into several smaller database to
reside on the same hardware, it may be better to make use of data
partitioning and/or making use of compound indexes where the left most
field of such index would be the field which holds the values you've
implicitly partitioned, in your case this field would be "year".


Regards,
Allan.

pgsql-general by date:

Previous
From: "Burcher, Greg"
Date:
Subject: More log detail on deadlock detection
Next
From: Alban Hertroys
Date:
Subject: Re: Multithreaded query onto 4 postgresql instances