Re: [HACKERS] Needs Suggestion

2011-04-19 Thread Vibhor Kumar

On Apr 20, 2011, at 4:08 AM, SUBHAM ROY wrote:

> Suppose Postgres is installed in two computers C1 & C2.
> C1 have some database tables. How can I copy these database tables from C1 to 
> C2.
> I mean to say that can I copy tables from postgres installed in one m/c to 
> another m/c. 
> Is there any command in postgres to do so or any other short cut technique. 

Use pg_dump/pg_restore command to copy the tables from One database to another.
http://www.postgresql.org/docs/9.0/interactive/backup-dump.html 

Thanks & Regards,
Vibhor Kumar
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
vibhor.ku...@enterprisedb.com
Blog:http://vibhork.blogspot.com


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


[HACKERS] Needs Suggestion

2011-04-19 Thread SUBHAM ROY
Suppose Postgres is installed in two computers C1 & C2.
C1 have some database tables. How can I copy these database tables from C1
to C2.
I mean to say that can I copy tables from postgres installed in one m/c to
another m/c.
Is there any command in postgres to do so or any other short cut technique.


-- 
Thank You,
Subham Roy,
CSE IIT Bombay.


Re: [HACKERS] Needs Suggestion

2011-03-28 Thread Dimitri Fontaine
SUBHAM ROY  writes:
> I want to know how can we measure the execution time of a query in Postgres
> (Explain analyze will not do). Also is there any tools available in Linux
> for measuring the performance of queries of databases such as Oracle 11g,
> Postgres, etc.
> Any suggestions will be very helpful.

Try pgbench (in contribs) and then Tsung, that could help you run a test
suite and get time reports.  See also pgbench-tools.

  http://www.westnet.com/~gsmith/content/postgresql/pgbench-tools.htm

Regards,
-- 
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support

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


[HACKERS] Re: [HACKERS] Needs Suggestion

2011-03-27 Thread Tomáš Pospíšil
You could use this in psql. Don't know how precise is it, but is enought for 
initial testing.

postgres=# \timing
Timing is on.
postgres=# create index dx on diplomka using gist(data);
CREATE INDEX
Time: 236752.569 ms


>  Původní zpráva 
> Od: SUBHAM ROY 
> Předmět: Re: [HACKERS] Needs Suggestion
> Datum: 27.3.2011 19:02:32
> 
> Actually, I want to run some set of queries in postgres on a HUGE data set.
> I have to compute the actual execution time for each of those queries. So
> how can I do that in Postgres ?
>
> Suppose in Oracle following thing can be done :
> *
> set timing on;
> select stuff from mytab;
>
> Elapsed: 00:00:02.82
>
> *Likewise, can I do this in Postgres? "set timing on" does not work in
> Postgres.
> Also is there any free tools available in Linux for doing so?
>
> On Sun, Mar 27, 2011 at 10:20 PM, Gurjeet Singh 
> wrote:
>
> > On Sun, Mar 27, 2011 at 9:22 AM, SUBHAM ROY  wrote:
> >
> >> Hi,
> >> I am currently a student of IIT Bombay. I am doing a project on "Benchmark
> >> design". For that I need to measure the performance of various queries in
> >> databases.
> >> I want to know how can we measure the execution time of a query in
> >> Postgres (Explain analyze will not do). Also is there any tools available 
> >> in
> >> Linux for measuring the performance of queries of databases such as Oracle
> >> 11g, Postgres, etc.
> >> Any suggestions will be very helpful.
> >>
> >
> > If EXPLAIN ANALYZE is not sufficient for your purpose, then you need
> > elaborate what exactly are you looking for.
> >
> > Regards,
> > --
> > Gurjeet Singh
> > EnterpriseDB Corporation
> > The Enterprise PostgreSQL Company
> >
> >
>
>
> --
> Thank You,
> Subham Roy,
> CSE IIT Bombay.
>
>
>

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


Re: [HACKERS] Needs Suggestion

2011-03-27 Thread Gurjeet Singh
In these (Postgres) mailing lists, top-posting is not preferred. See my
response below.

On Sun, Mar 27, 2011 at 1:01 PM, SUBHAM ROY  wrote:

>
> On Sun, Mar 27, 2011 at 10:20 PM, Gurjeet Singh 
> wrote:
>
>> On Sun, Mar 27, 2011 at 9:22 AM, SUBHAM ROY  wrote:
>>
>>> Hi,
>>> I am currently a student of IIT Bombay. I am doing a project on
>>> "Benchmark design". For that I need to measure the performance of various
>>> queries in databases.
>>> I want to know how can we measure the execution time of a query in
>>> Postgres (Explain analyze will not do). Also is there any tools available in
>>> Linux for measuring the performance of queries of databases such as Oracle
>>> 11g, Postgres, etc.
>>> Any suggestions will be very helpful.
>>>
>>
>> If EXPLAIN ANALYZE is not sufficient for your purpose, then you need
>> elaborate what exactly are you looking for.
>>
>>  Actually, I want to run some set of queries in postgres on a HUGE data
> set.
> I have to compute the actual execution time for each of those queries. So
> how can I do that in Postgres ?
>
> Suppose in Oracle following thing can be done :
> *
> set timing on;
> select stuff from mytab;
>
> Elapsed: 00:00:02.82
>
> *Likewise, can I do this in Postgres? "set timing on" does not work in
> Postgres.
> Also is there any free tools available in Linux for doing so?
>

Postgres' command-line clinet is psql, and it has a meta-command

\timing (or \t for short)

This will show you the query execution time, including the network roundtrip
it takes to send the query and receive the response.

If you don't want to account for network round trips, the the server has a
GUC parameter called log_min_duration_statement [1]. Either you change it's
value in postgresql.conf (so it affects all connections thereafter), or use
SQL command

set log_min_duration_statement = 0;

as the first command in all your sessions to log all queries.

psql's \t command results in times being shown right in the psql session,
but setting log_min_duration_statement results in query and time taken beong
logged in server logs (usually under $PGDATA/pg_log/ or in syslog).

[1]
http://www.postgresql.org/docs/current/static/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHEN

HTH,
-- 
Gurjeet Singh
EnterpriseDB Corporation
The Enterprise PostgreSQL Company


Re: [HACKERS] Needs Suggestion

2011-03-27 Thread SUBHAM ROY
Actually, I want to run some set of queries in postgres on a HUGE data set.
I have to compute the actual execution time for each of those queries. So
how can I do that in Postgres ?

Suppose in Oracle following thing can be done :
*
set timing on;
select stuff from mytab;

Elapsed: 00:00:02.82

*Likewise, can I do this in Postgres? "set timing on" does not work in
Postgres.
Also is there any free tools available in Linux for doing so?

On Sun, Mar 27, 2011 at 10:20 PM, Gurjeet Singh wrote:

> On Sun, Mar 27, 2011 at 9:22 AM, SUBHAM ROY  wrote:
>
>> Hi,
>> I am currently a student of IIT Bombay. I am doing a project on "Benchmark
>> design". For that I need to measure the performance of various queries in
>> databases.
>> I want to know how can we measure the execution time of a query in
>> Postgres (Explain analyze will not do). Also is there any tools available in
>> Linux for measuring the performance of queries of databases such as Oracle
>> 11g, Postgres, etc.
>> Any suggestions will be very helpful.
>>
>
> If EXPLAIN ANALYZE is not sufficient for your purpose, then you need
> elaborate what exactly are you looking for.
>
> Regards,
> --
> Gurjeet Singh
> EnterpriseDB Corporation
> The Enterprise PostgreSQL Company
>
>


-- 
Thank You,
Subham Roy,
CSE IIT Bombay.


Re: [HACKERS] Needs Suggestion

2011-03-27 Thread Gurjeet Singh
On Sun, Mar 27, 2011 at 9:22 AM, SUBHAM ROY  wrote:

> Hi,
> I am currently a student of IIT Bombay. I am doing a project on "Benchmark
> design". For that I need to measure the performance of various queries in
> databases.
> I want to know how can we measure the execution time of a query in Postgres
> (Explain analyze will not do). Also is there any tools available in Linux
> for measuring the performance of queries of databases such as Oracle 11g,
> Postgres, etc.
> Any suggestions will be very helpful.
>

If EXPLAIN ANALYZE is not sufficient for your purpose, then you need
elaborate what exactly are you looking for.

Regards,
-- 
Gurjeet Singh
EnterpriseDB Corporation
The Enterprise PostgreSQL Company


Re: [HACKERS] Needs Suggestion

2011-03-27 Thread 3dmashup

Subham,

I would  start with reviewing  Prof Mike Stonebrakers and  Dr Paula 
Hawthorns paper  http://portal.acm.org/citation.cfm?doid=582095.582097
you can also look  at Perftrack   
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.101.7063&rep=rep1&type=pdf


regards

3dmashUp

On 3/27/2011 6:22 AM, SUBHAM ROY wrote:

Hi,
I am currently a student of IIT Bombay. I am doing a project on 
"Benchmark design". For that I need to measure the performance of 
various queries in databases.
I want to know how can we measure the execution time of a query in 
Postgres (Explain analyze will not do). Also is there any tools 
available in Linux for measuring the performance of queries of 
databases such as Oracle 11g, Postgres, etc.

Any suggestions will be very helpful.

--
Thank You,
Subham Roy,
CSE IIT Bombay.




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


[HACKERS] Needs Suggestion

2011-03-27 Thread SUBHAM ROY
Hi,
I am currently a student of IIT Bombay. I am doing a project on "Benchmark
design". For that I need to measure the performance of various queries in
databases.
I want to know how can we measure the execution time of a query in Postgres
(Explain analyze will not do). Also is there any tools available in Linux
for measuring the performance of queries of databases such as Oracle 11g,
Postgres, etc.
Any suggestions will be very helpful.

-- 
Thank You,
Subham Roy,
CSE IIT Bombay.


Re: [HACKERS] Needs Suggestion

2010-09-23 Thread Andrew Dunstan




On 09/22/2010 05:03 AM, sub...@cse.iitb.ac.in wrote:


Actually, I used palloc() to set the stack base address.
And I am trying to create only a single thread, then also it is causing
problem.


Did you not understand when people told you this wasn't going to work? 
Don't create any threads.


cheers

andrew

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


Re: [HACKERS] Needs Suggestion

2010-09-23 Thread subham

So, Can I increase the stack depth limit to a large value ?


> On 22/09/10 12:03, sub...@cse.iitb.ac.in wrote:
>> Actually, I used palloc() to set the stack base address.
>> And I am trying to create only a single thread, then also it is causing
>> problem.
>> Actually, I created all the data-structures using palloc(), then I am
>> passing these to the child thread. Even if I make these variables global
>> then also it is not working.
>> But if I don't set its stack address then it is working. But I need to
>> do
>> that because when my thread body is big then it is causing stack fault.
>> So if I cannot set its stack address then Can I increase the stack depth
>> limit to a large value ?
>
> It's not clear what you're trying to do, but it's just not going to
> work. The backend code is not thread-safe, so you can't safely create
> any threads in server code. Not even a single one. And even if you
> could, you should not mess with stack base addresses.
>
> --
>Heikki Linnakangas
>EnterpriseDB   http://www.enterprisedb.com
>


-- 

Thank You,
Subham Roy.


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


Re: [HACKERS] Needs Suggestion

2010-09-23 Thread subham


Actually, I used palloc() to set the stack base address.
And I am trying to create only a single thread, then also it is causing
problem.
Actually, I created all the data-structures using palloc(), then I am
passing these to the child thread. Even if I make these variables global
then also it is not working.
But if I don't set its stack address then it is working. But I need to do
that because when my thread body is big then it is causing stack fault.
So if I cannot set its stack address then Can I increase the stack depth
limit to a large value ?

-- 

Thank You,
Subham Roy.

> On 22/09/10 11:14, sub...@cse.iitb.ac.in wrote:
>>
>> How can I increase the stack depth limit ? Is it only by modifying the
>> postgres.conf file, but there I cannot increase the stack depth beyond 4
>> MB.
>>
>> Actually, my problem is that, when I set the stack base address of the
>> child thread using the POSIX library function "pthread_setstackaddr()",
>> I
>> am unable to access the memory contents of its parent. The
>> data-structures
>> in the parent are either getting destroyed or unaccessible when moving
>> to
>> the context of the child thread.
>
> It is not a good idea to use threads in server code. PostgreSQL server
> code is not thread-safe, things will break.
>
> Assuming that you're not actually doing that but using threads in the
> client instead, max_stack_depth should have no effect on you as it only
> affects the server.
>
> But you really should find another way to communicate between threads.
> Stacks should be treated as thread-private. Use malloc() or something
> and global variables.
>
> --
>Heikki Linnakangas
>EnterpriseDB   http://www.enterprisedb.com
>





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


Re: [HACKERS] Needs Suggestion

2010-09-22 Thread Tom Lane
sub...@cse.iitb.ac.in writes:
> How can I increase the stack depth limit ? Is it only by modifying the
> postgres.conf file, but there I cannot increase the stack depth beyond 4
> MB.

> Actually, my problem is that, when I set the stack base address of the
> child thread using the POSIX library function "pthread_setstackaddr()", I
> am unable to access the memory contents of its parent.

You've got worse problems than the stack depth limit.  Creating multiple
threads inside a backend process is entirely unsupported and just about
guaranteed to result in massive breakage.  Don't do it.

regards, tom lane

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


Re: [HACKERS] Needs Suggestion

2010-09-22 Thread Heikki Linnakangas

On 22/09/10 12:03, sub...@cse.iitb.ac.in wrote:

Actually, I used palloc() to set the stack base address.
And I am trying to create only a single thread, then also it is causing
problem.
Actually, I created all the data-structures using palloc(), then I am
passing these to the child thread. Even if I make these variables global
then also it is not working.
But if I don't set its stack address then it is working. But I need to do
that because when my thread body is big then it is causing stack fault.
So if I cannot set its stack address then Can I increase the stack depth
limit to a large value ?


It's not clear what you're trying to do, but it's just not going to 
work. The backend code is not thread-safe, so you can't safely create 
any threads in server code. Not even a single one. And even if you 
could, you should not mess with stack base addresses.


--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

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


Re: [HACKERS] Needs Suggestion

2010-09-22 Thread Heikki Linnakangas

On 22/09/10 11:14, sub...@cse.iitb.ac.in wrote:


How can I increase the stack depth limit ? Is it only by modifying the
postgres.conf file, but there I cannot increase the stack depth beyond 4
MB.

Actually, my problem is that, when I set the stack base address of the
child thread using the POSIX library function "pthread_setstackaddr()", I
am unable to access the memory contents of its parent. The data-structures
in the parent are either getting destroyed or unaccessible when moving to
the context of the child thread.


It is not a good idea to use threads in server code. PostgreSQL server 
code is not thread-safe, things will break.


Assuming that you're not actually doing that but using threads in the 
client instead, max_stack_depth should have no effect on you as it only 
affects the server.


But you really should find another way to communicate between threads. 
Stacks should be treated as thread-private. Use malloc() or something 
and global variables.


--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

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


[HACKERS] Needs Suggestion

2010-09-22 Thread subham

How can I increase the stack depth limit ? Is it only by modifying the
postgres.conf file, but there I cannot increase the stack depth beyond 4
MB.

Actually, my problem is that, when I set the stack base address of the
child thread using the POSIX library function "pthread_setstackaddr()", I
am unable to access the memory contents of its parent. The data-structures
in the parent are either getting destroyed or unaccessible when moving to
the context of the child thread.
But when I create the child thread without setting its stack base address
then it is able to access the parent's memory contents. But if the child
thread's code size is large then it is getting stack fault and displaying
the message "MAX stack depth limit reached ...".
Can anyone give any reason why is that so ?
OR
If I cannot set the child thread's stack base address. Then How can I
increase the stack depth limit to a large value ?

-- 

Thank You,
Subham Roy.


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


Re: [HACKERS] Needs Suggestion

2010-09-02 Thread Robert Haas
On Mon, Aug 30, 2010 at 11:12 AM,   wrote:
> Can anyone explain this ?
>
> My question is -
> What is lnext:; , lreplace:; in postgres code ?
> I found lnext:; in 1501 and lreplace:; in 2065 in execMain.c file.

It's a label.

http://www.lysator.liu.se/c/bwk-tutor.html#goto

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

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


[HACKERS] Needs Suggestion

2010-09-02 Thread subham


Can anyone explain this ?

My question is -
What is lnext:; , lreplace:; in postgres code ?
I found lnext:; in 1501 and lreplace:; in 2065 in execMain.c file.


-- 

Thank You,
Subham Roy.
CSE,
IIT Bombay.





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


Re: [HACKERS] Needs Suggestion

2010-08-05 Thread Tom Lane
sub...@cse.iitb.ac.in writes:
> I need suggestion about how region based memory management is done in
> postgres.

Have you read src/backend/utils/mmgr/README ?  It's old but still
reasonably accurate.

regards, tom lane

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


[HACKERS] Needs Suggestion

2010-08-05 Thread subham

I need suggestion about how region based memory management is done in
postgres. I know the concept of region based memory management and also
know about the functions like memorycontextswitch().

But I am not understanding how Postgres uses hierarchical, region-based
memory management. That is I am not getting the inner idea or meaning of
the code.

Currently, my project topic is "Parallelizing the spatial join" using
POSIX threads, so I have to understand the inner details and meanings
of the code. I am using "ddd" to step through its code, from there I am
getting the flow of the code but not understanding the semantics of its
data-structures and its region based memory management.

Kindly, if anybody can give some Ideas or Suggestions.


Thank You,
Subham Roy,
CSE,
IIT Bombay.



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


Re: [HACKERS] Needs Suggestion

2010-07-03 Thread Robert Haas
On Sat, Jul 3, 2010 at 1:04 PM,   wrote:
> I am currently a student of IIT Bombay of CSE department. I am doing a
> project on postgres. I need to understand its code thoroughly, so I need
> "ddd" to "step through" its code. I need to start postgres on the
> "backend" mode to work it with "ddd".But I am facing some difficulties in
> setting up the "ddd" with "postgres" in "backend" mode.
>
> I installed postgres many times using the instruction mentioned in the
> file "INSTALL". Starting the postgres from foreground is working fine but
> the "backend" mode does not work.
>
> Kindly, suggest me how to run the postgres in "backend" mode. I have to
> understand its code thoroughly to do my postgres project.

If by "backend" mode you mean a standalone backend, try "postgres --single".

If you mean something else... you'll need to explain a bit more.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

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


Re: [HACKERS] Needs Suggestion

2010-07-03 Thread Bruce Momjian
sub...@cse.iitb.ac.in wrote:
> 
> Hi,
> 
> I am currently a student of IIT Bombay of CSE department. I am doing a
> project on postgres. I need to understand its code thoroughly, so I need
> "ddd" to "step through" its code. I need to start postgres on the
> "backend" mode to work it with "ddd".But I am facing some difficulties in
> setting up the "ddd" with "postgres" in "backend" mode.
> 
> I installed postgres many times using the instruction mentioned in the
> file "INSTALL". Starting the postgres from foreground is working fine but
> the "backend" mode does not work.
> 
> Kindly, suggest me how to run the postgres in "backend" mode. I have to
> understand its code thoroughly to do my postgres project.

I suggest you look here first:

http://www.postgresql.org/developer/coding

and at the developer's faq.

-- 
  Bruce Momjian  http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + None of us is going to be here forever. +

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


[HACKERS] Needs Suggestion

2010-07-03 Thread subham

Hi,

I am currently a student of IIT Bombay of CSE department. I am doing a
project on postgres. I need to understand its code thoroughly, so I need
"ddd" to "step through" its code. I need to start postgres on the
"backend" mode to work it with "ddd".But I am facing some difficulties in
setting up the "ddd" with "postgres" in "backend" mode.

I installed postgres many times using the instruction mentioned in the
file "INSTALL". Starting the postgres from foreground is working fine but
the "backend" mode does not work.

Kindly, suggest me how to run the postgres in "backend" mode. I have to
understand its code thoroughly to do my postgres project.


Thank You,
Subham Roy,
CSE,
IIT Bombay.



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