c function: keep objects in memory for all session or all transaction

From: Christian Gonzalez <christian(dot)gonzalez(at)sigis(dot)com(dot)ve>
To: pgsql-hackers(at)postgresql(dot)org
Subject: c function: keep objects in memory for all session or all transaction
Date: 2009-09-02 15:29:09
Message-ID: 4A9E8F45.2080106@sigis.com.ve
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi everybody,
I am new PostgreSQL c function programmer. I'm trying to move ahead
a new "PostgreSQL routing library" (http://www.pgroute.org [for now, the
page in only in spanish]).

The point:
There is some way to keep objects in [persisten] memory and then refer
to these from c functions?. In the current version of pgRoute, each
transaction load the graph in memory (using MemoryContext), this isn't a
enterprise solution for routing program. Why I Wish is using a c
function to load the graph in memory [persistent], something like:

SELECT pgr_load_graph('my SQL graph sentence', 'graph name');
example: SELECT pgr_load_graph('SELECT id, source, target,
cost1,cost2,costn,... FROM edge_table WHERE ...','My graph');
would also have a function to unload or delete.

and then, use other function to calculating the shortest path, something
like:
SELECT pgr_get_shortest_path('from','to','cost
column','algorithm','graph name');
example: SELECT
pgr_get_shortest_path(6000,5142,'cost1','dijkstra','My graph');

researching in the PostgreSQL source code I found
"postgresql-8.4.0/src/backend/utils/mmgr/README.TXT", and I think the
indicated MemoryContext that I need to solved my problem is
"TopMemoryContext", but I don't found examples of how can I used it.

I need some guidelines, or way to resolved this. Is posible to put
persisten object in memory through postgresql c funtion?, or my idea is
a crazy idea?

Thanks a lot for your time and answers, ahhh! and for my English writing.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Devrim GÜNDÜZ 2009-09-02 15:37:08 Re: Linux LSB init script
Previous Message Andrew Dunstan 2009-09-02 15:25:33 Re: Linux LSB init script