Re: [GENERAL] File system level copy

2012-11-15 Thread Albe Laurenz
Hao Wang wrote: I installed PostgresSQL-8.3 on my linux machine. The cluster directory is /usr/local/data and I created three databases named db1, db2, and db3. db1 is in the default tablespace 'pg_default'. db2 is in '/home/tablespace/space1/' and db3 is in '/home/tablespace/space2/'. I

Re: [GENERAL] File system level copy

2012-11-15 Thread Wang, Hao
My purpose is not to do backup for my database. I just want to copy the whole db3 database to another machine and restore it. That database could be very large so I think directly copy is more efficient than pg_dump. So I'd like to do some test to see if this way works. If it doesn't work, I

Re: [GENERAL] Finding first free time from reservations table

2012-11-15 Thread hari . fuchs
Andrus kobrule...@hot.ee writes: How to find first free half hour in table which is not reserved ? E.q if table contains startdate starthour duration 14 9 1 -- ends at 9:59 14 10 1.5-- ends at 11:29, e.q there is 30

Re: [GENERAL] File system level copy

2012-11-15 Thread Albe Laurenz
Hao Wang wrote: My purpose is not to do backup for my database. I understood that. It was just a side comment. I just want to copy the whole db3 database to another machine and restore it. That database could be very large so I think directly copy is more efficient than pg_dump. So I'd

[GENERAL] Postgres Index

2012-11-15 Thread Vishalakshi Navaneethakrishnan
Hi all, Can we create composite index for one text column and integer column? Thanks in advance.. -- Best Regards, Vishalakshi.N

Re: [GENERAL] Postgres Index

2012-11-15 Thread Thomas Kellerer
Vishalakshi Navaneethakrishnan, 15.11.2012 12:11: Hi all, Can we create composite index for one text column and integer column? Yes of course. What happened when you tried? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

Re: [GENERAL] Postgres Index

2012-11-15 Thread Albe Laurenz
Vishalakshi Navaneethakrishnan wrote: Can we create composite index for one text column and integer column? Yes. It would probably have been faster to try it than to send this e-mail... Yours, Laurenz Albe -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes

Re: [GENERAL] Strategies/Best Practises Handling Large Tables

2012-11-15 Thread Chitra Creta
Thanks for your example Chris. I will look into it as a long-term solution. Partitioning tables as a strategy worked very well indeed. This will be my short/medium term solution. Another strategy that I would like to evaluate as a short/medium term solution is archiving old records in a table

Re: [GENERAL] Postgres Index

2012-11-15 Thread Dann Corbit
Here is the current formal definition for index creation: http://www.postgresql.org/docs/9.2/static/sql-createindex.html From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Vishalakshi Navaneethakrishnan Sent: Thursday, November 15, 2012 3:12 AM

[GENERAL] How to list all schema names inside a PostgreSQL database through SQL

2012-11-15 Thread Xiaobo Gu
Hi, How can I list all schema names inside a PostgreSQL database through SQL, especially thoese without any objects created inside it. Regards, Xiaobo Gu -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

Re: [GENERAL] How to list all schema names inside a PostgreSQL database through SQL

2012-11-15 Thread Виктор Егоров
2012/11/15 Xiaobo Gu guxiaobo1...@gmail.com: How can I list all schema names inside a PostgreSQL database through SQL, especially thoese without any objects created inside it. Something like this: select n.nspname, count(o.oid) from pg_namespace n left join pg_class o on

Re: [GENERAL] How to list all schema names inside a PostgreSQL database through SQL

2012-11-15 Thread Achilleas Mantzios
On Πεμ 15 Νοε 2012 20:31:05 Xiaobo Gu wrote: Hi, How can I list all schema names inside a PostgreSQL database through SQL, especially thoese without any objects created inside it. 1st solution : select catalog_name,schema_name from information_schema.schemata ; 2nd solution :

Re: [GENERAL] How to list all schema names inside a PostgreSQL database through SQL

2012-11-15 Thread sk baji
If you are looking for list of empty schema's (No objects in schema), then you can use below query: select nspname from pg_namespace where oid not in (select relnamespace from pg_class) and oid not in (select oid from pg_proc); Regards, Baji Shaik. On Thu, Nov 15, 2012 at 6:13 PM, Achilleas

Re: [GENERAL] Strategies/Best Practises Handling Large Tables

2012-11-15 Thread Igor Romanchenko
On Thu, Nov 15, 2012 at 1:34 PM, Chitra Creta chitracr...@gmail.com wrote: Thanks for your example Chris. I will look into it as a long-term solution. Partitioning tables as a strategy worked very well indeed. This will be my short/medium term solution. Another strategy that I would like to

[GENERAL] Plproxy with returns table() make PG segfault

2012-11-15 Thread Sébastien Lardière
Hi, I've a segfault on a PostgreSQL 9.1 cluster, with a plproxy function call. Both PostgreSQL and plproxy are up to date. I use SQL/MED in that specific case, but it's the same without. I reproduced the following scenario on a few clusters, with or without streaming replication. On a given

Re: [GENERAL] High SYS CPU - need advise

2012-11-15 Thread Merlin Moncure
On Wed, Nov 14, 2012 at 4:08 PM, John R Pierce pie...@hogranch.com wrote: On 11/14/12 1:34 PM, Vlad wrote: thanks for your feedback. While implementing connection pooling would make resources utilization more efficient, I don't think it's the root of my problem. Most of the connected clients

Re: [GENERAL] High SYS CPU - need advise

2012-11-15 Thread Vlad
there is no big spike of queries that cause that, queries come in relatively stable pace. It's just when the higher rate of queries coming, the more likely this to happen. yes, when stall happens , the active queries pile up - but that's the result of a stall (the server reacts slow on a

Re: [GENERAL] Finding first free time from reservations table

2012-11-15 Thread Steve Crawford
On 11/14/2012 01:02 PM, Andrus wrote: I’m looking for a way to find first free time in reservations table. Reservation table contains reservations start dates, start hours and durations. Start hour is by half hour increments in working hours 8:00 .. 18:00 in work days. Duration is also by

Re: [GENERAL] Plproxy with returns table() make PG segfault

2012-11-15 Thread Cédric Villemain
top post: this looks like a plproxy bug (no ?), I've added Marko in CC. I've a segfault on a PostgreSQL 9.1 cluster, with a plproxy function call. Both PostgreSQL and plproxy are up to date. I use SQL/MED in that specific case, but it's the same without. I reproduced the following scenario on

Re: [GENERAL] High SYS CPU - need advise

2012-11-15 Thread Merlin Moncure
On Thu, Nov 15, 2012 at 11:50 AM, Vlad marche...@gmail.com wrote: there is no big spike of queries that cause that, queries come in relatively stable pace. It's just when the higher rate of queries coming, the more likely this to happen. yes, when stall happens , the active queries pile up -

Re: [GENERAL] High SYS CPU - need advise

2012-11-15 Thread Vlad
Merlin, this is not my report, probably from a thread that I've referenced as having a common symptoms. Here is info about my db: Postgresql 9.1.6. Postgres usually has 400-500 connected clients, most of them are idle. Database is over 1000 tables (across 5 namespaces), taking ~150Gb on disk.

Re: [GENERAL] High SYS CPU - need advise

2012-11-15 Thread Merlin Moncure
On Thu, Nov 15, 2012 at 2:20 PM, Vlad marche...@gmail.com wrote: Merlin, this is not my report, probably from a thread that I've referenced as having a common symptoms. Here is info about my db: Postgresql 9.1.6. Postgres usually has 400-500 connected clients, most of them are idle.

Re: [GENERAL] High SYS CPU - need advise

2012-11-15 Thread Vlad
yeah. ok, nest steps: *) can you confirm that postgres process is using high cpu (according to top) during stall time yes, CPU is spread across a lot of postmasters PID USER PR NI VIRT RES SHR S %CPU %MEMTIME+ COMMAND 29863 pgsql 20 0 3636m 102m 36m R 19.1 0.3

Re: [GENERAL] How to list all schema names inside a PostgreSQL database through SQL

2012-11-15 Thread Ondrej Ivanič
Hi, On 15 November 2012 23:31, Xiaobo Gu guxiaobo1...@gmail.com wrote: How can I list all schema names inside a PostgreSQL database through SQL, especially thoese without any objects created inside it. Use -E psql's option: -E, --echo-hiddendisplay queries that internal commands

Re: [GENERAL] High SYS CPU - need advise

2012-11-15 Thread Merlin Moncure
On Thu, Nov 15, 2012 at 2:44 PM, Vlad marche...@gmail.com wrote: yeah. ok, nest steps: *) can you confirm that postgres process is using high cpu (according to top) during stall time yes, CPU is spread across a lot of postmasters PID USER PR NI VIRT RES SHR S %CPU %MEM

Re: [GENERAL] High SYS CPU - need advise

2012-11-15 Thread Merlin Moncure
On Thu, Nov 15, 2012 at 3:49 PM, Merlin Moncure mmonc...@gmail.com wrote: On Thu, Nov 15, 2012 at 2:44 PM, Vlad marche...@gmail.com wrote: yeah. ok, nest steps: *) can you confirm that postgres process is using high cpu (according to top) during stall time yes, CPU is spread across a lot

Re: [GENERAL] High SYS CPU - need advise

2012-11-15 Thread Alvaro Herrera
Merlin Moncure escribió: ok, excellent. reviewing the log, this immediately caught my eye: recvfrom(8, \27\3\1\0@, 5, 0, NULL, NULL) = 5 recvfrom(8, \327\327\nl\231LD\211\346\243@WW\254\244\363C\326\247\341\177\255\263~\327HDv-\3466\353..., 64, 0, NULL, NULL) = 64 select(0, NULL, NULL,

Re: [GENERAL] High SYS CPU - need advise

2012-11-15 Thread Vlad
sorry - no panics / errors in the log... -- Vlad

[GENERAL] Percent of Total in Histogram Query

2012-11-15 Thread Paul Jungwirth
Hello, I'd like to write a histogram-like query that shows these columns: - x-value from 0 to k. - number of rows with that x-value. - number of rows seen so far (i.e. with the current x-value or less). - % of total rows seen so far. The following query works for the first three columns,

Re: [GENERAL] High SYS CPU - need advise

2012-11-15 Thread Merlin Moncure
On Thu, Nov 15, 2012 at 4:29 PM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: Merlin Moncure escribió: ok, excellent. reviewing the log, this immediately caught my eye: recvfrom(8, \27\3\1\0@, 5, 0, NULL, NULL) = 5 recvfrom(8,

Re: [GENERAL] Percent of Total in Histogram Query

2012-11-15 Thread David Johnston
From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Paul Jungwirth Sent: Thursday, November 15, 2012 5:44 PM To: pgsql-general@postgresql.org Subject: [GENERAL] Percent of Total in Histogram Query Hello, I'd like to write a histogram-like

Re: [GENERAL] High SYS CPU - need advise

2012-11-15 Thread Tom Lane
Merlin Moncure mmonc...@gmail.com writes: What I've been scratching my head over is what code exactly would cause an iterative sleep like the above. The code is here: pg_usleep(cur_delay * 1000L); /* increase delay by a random fraction between 1X and 2X */ cur_delay += (int)

Re: [GENERAL] High SYS CPU - need advise

2012-11-15 Thread Vlad Marchenko
Tom, I just checked the version I'm running (9.1.6), and the code is quite similar (src/backend/storage/lmgr/s_lock.c) pg_usleep(cur_delay * 1000L); #if defined(S_LOCK_TEST) fprintf(stdout, *); fflush(stdout); #endif /* increase delay by a

Re: [GENERAL] High SYS CPU - need advise

2012-11-15 Thread Jeff Janes
On Thu, Nov 15, 2012 at 2:44 PM, Merlin Moncure mmonc...@gmail.com wrote: select(0, NULL, NULL, NULL, {0, 1000}) = 0 (Timeout) select(0, NULL, NULL, NULL, {0, 1000}) = 0 (Timeout) select(0, NULL, NULL, NULL, {0, 1000}) = 0 (Timeout) select(0, NULL, NULL, NULL, {0, 2000}) = 0 (Timeout)

[GENERAL] Purge Logs from pgagent

2012-11-15 Thread P. Broennimann
Hi there I am using pgagent without problems but I have a few questions: - I see that pgagent does log its acivities in the tables pga_joblog and pga_jobsteplog. My log gets quiet big. 1) Is it save to empty these tables once a while manually? 2) Is there a settings to tell pgagent to purge