Re: [GENERAL] Fwd: Ask for a question

2015-01-21 Thread Paul Jungwirth
Hi Pierre, Looking at your Excel document I think I misinterpreted, and you are trying to take the stddev of each column separately (which makes a lot more sense!). In the case you can say this: select id, stddev(a), stddev(b), stddev(c) from foo group by id; Paul On Wed, Jan 21, 2015 at

Re: [GENERAL] Fwd: Ask for a question

2015-01-21 Thread Paul Jungwirth
Oh sorry, you should leave off the grouping: select stddev(a), stddev(b), stddev(c) from foo; Paul On Wed, Jan 21, 2015 at 10:24 AM, Paul Jungwirth p...@illuminatedcomputing.com wrote: Hi Pierre, Looking at your Excel document I think I misinterpreted, and you are trying to take the stddev

Re: [GENERAL] Fwd: Ask for a question

2015-01-21 Thread Rob Sargent
On 01/21/2015 11:02 AM, Pierre Hsieh wrote: Hi Raymond, Thanks for your reply. Please see detail as following. Thanks again. Pierre Inline image 1 On Thu, Jan 22, 2015 at 1:48 AM, Raymond O'Donnell r...@iol.ie mailto:r...@iol.ie wrote: On 21/01/2015 17:32, Pierre Hsieh wrote: Hi

Re: [GENERAL] Fwd: Ask for a question

2015-01-21 Thread Rob Sargent
On 01/21/2015 11:31 AM, Pierre Hsieh wrote: updated rule Inline image 1 On Thu, Jan 22, 2015 at 2:28 AM, Pierre Hsieh pierre.hs...@gmail.com mailto:pierre.hs...@gmail.com wrote: Thanks for your reply. Let me to describe the purpose for this calculation roughly. Column B is for

Re: [GENERAL] Fwd: Ask for a question

2015-01-21 Thread Pierre Hsieh
Thanks for your reply. Let me to describe the purpose for this calculation roughly. Column B is for the price of stock. Column C D are the slope and interception of linear regression from Column B. The final result which I need is the standard deviation on the difference between stock price and

Re: [GENERAL] Fwd: Ask for a question

2015-01-21 Thread Paul Jungwirth
Hi Pierre, It looks like you're saying that each row has an id plus three numeric columns, and you want the stddev calculated from the three numeric columns? In that case you could do this: create table foo (id integer, a float, b float, c float); insert into foo values (1, 2,3,4); insert into

Re: [GENERAL] Fwd: Ask for a question

2015-01-21 Thread Raymond O'Donnell
On 21/01/2015 17:32, Pierre Hsieh wrote: Hi guys, Thanks for your replies. I certainly can use VBA and ADODB object in Excel to do it. Due to performance, I wanna try to do it by SQL command in PG. However, I am not expert in PG, so I need few help from your guys. Let me to describe my

Re: [GENERAL] Fwd: Ask for a question

2015-01-21 Thread Pierre Hsieh
Hi Raymond, Thanks for your reply. Please see detail as following. Thanks again. Pierre [image: Inline image 1] On Thu, Jan 22, 2015 at 1:48 AM, Raymond O'Donnell r...@iol.ie wrote: On 21/01/2015 17:32, Pierre Hsieh wrote: Hi guys, Thanks for your replies. I certainly can use VBA

Re: [GENERAL] Fwd: Ask for a question

2015-01-21 Thread Raymond O'Donnell
On 21/01/2015 18:02, Pierre Hsieh wrote: Hi Raymond, Thanks for your reply. Please see detail as following. Thanks again. Can you describe *in words* what sort of calculation you want to do? Ray. -- Raymond O'Donnell :: Galway :: Ireland r...@iol.ie -- Sent via pgsql-general mailing

Re: [GENERAL] splitting up tables based on read/write frequency of columns

2015-01-21 Thread Jonathan Vanasco
On Jan 19, 2015, at 5:07 PM, Stefan Keller wrote: Hi I'm pretty sure PostgreSQL can handle this. But since you asked with a theoretic background, it's probably worthwhile to look at column stores (like [1]). Wow. I didn't know there was a column store extension for PG -- this would come

Re: [GENERAL] Fwd: Ask for a question

2015-01-21 Thread Raymond O'Donnell
On 21/01/2015 14:38, Pierre Hsieh wrote: Hi, Would you please tell me whether PostgreSQL can execute the following tasks? If not, please also tell me which one can help me for that. Thanks Not clear what you're asking, but if you just want to find the standard deviation of a sample

Re: [GENERAL] Fwd: Ask for a question

2015-01-21 Thread Rémi Cura
More bluntly maybe : if you can do it in Excel, you can do it in Postgres. Cheers, Rémi-C 2015-01-21 16:37 GMT+01:00 Raymond O'Donnell r...@iol.ie: On 21/01/2015 14:38, Pierre Hsieh wrote: Hi, Would you please tell me whether PostgreSQL can execute the following tasks? If not,

Re: [GENERAL] Fwd: Ask for a question

2015-01-21 Thread Brian Dunavant
This is not quite true. I don't believe there are any flight simulator easter-eggs hidden inside the Postgres code. :) On Wed, Jan 21, 2015 at 10:59 AM, Rémi Cura remi.c...@gmail.com wrote: More bluntly maybe : if you can do it in Excel, you can do it in Postgres. Cheers, Rémi-C

Re: [GENERAL] Fwd: Ask for a question

2015-01-21 Thread Raymond O'Donnell
On 21/01/2015 16:06, Brian Dunavant wrote: This is not quite true. I don't believe there are any flight simulator easter-eggs hidden inside the Postgres code. :) No? Awww. :-) Ray. -- Raymond O'Donnell :: Galway :: Ireland r...@iol.ie -- Sent via pgsql-general mailing list

Re: [GENERAL] splitting up tables based on read/write frequency of columns

2015-01-21 Thread David G Johnston
Jonathan Vanasco-7 wrote This is really a theoretical/anecdotal question, as I'm not at a scale yet where this would measurable. I want to investigate while this is fresh in my mind... I recall reading that unless a row has columns that are TOASTed, an `UPDATE` is essentially an `INSERT +

Re: [GENERAL] Fwd: Ask for a question

2015-01-21 Thread Pierre Hsieh
Hi guys, Thanks for your replies. I certainly can use VBA and ADODB object in Excel to do it. Due to performance, I wanna try to do it by SQL command in PG. However, I am not expert in PG, so I need few help from your guys. Let me to describe my question clearly as following. The final results

[GENERAL] ORDER BY in prepared statements

2015-01-21 Thread Bryn Jeffries
In a number of places on the web I've seen it claimed that ordering can be set via prepared statements. Indeed, the expected syntax is accepted on my 9.3 server without errors: sandbox=# CREATE TABLE test ( id serial PRIMARY KEY, gender char ); sandbox=# INSERT INTO test(gender) VALUES('m')

Re: [GENERAL] ORDER BY in prepared statements

2015-01-21 Thread Paul Jungwirth
In a number of places on the web I've seen it claimed that ordering can be set via prepared statements. ... sandbox=# PREPARE testplan(text) AS SELECT * FROM test ORDER BY $1; But the output is not what one would expect: sandbox=# EXECUTE testplan('gender'); ... As opposed to:

Re: [GENERAL] ORDER BY in prepared statements

2015-01-21 Thread David G Johnston
Paul Jungwirth wrote In a number of places on the web I've seen it claimed that ordering can be set via prepared statements. ... sandbox=# PREPARE testplan(text) AS SELECT * FROM test ORDER BY $1; But the output is not what one would expect: sandbox=# EXECUTE testplan('gender'); ... As

Re: [GENERAL] ORDER BY in prepared statements

2015-01-21 Thread Adrian Klaver
On 01/21/2015 12:51 PM, Bryn Jeffries wrote: In a number of places on the web I've seen it claimed that ordering can be set via prepared statements. Can you give a link to one of those examples? Many thanks, Bryn -- Adrian Klaver adrian.kla...@aklaver.com -- Sent via pgsql-general

Re: [GENERAL] ORDER BY in prepared statements

2015-01-21 Thread Bryn Jeffries
Sorry, I can't find any now. It's cropped up in a few forums, in the context of executing queries from web services. Clearly not significantly enough to show up in Google... - Reply message - From: Adrian Klaver adrian.kla...@aklaver.com To: Bryn Jeffries bryn.jeffr...@sydney.edu.au,

Re: [GENERAL] ORDER BY in prepared statements

2015-01-21 Thread Bryn Jeffries
Paul Jungwirth wrote I'm not sure how to make a prepared statement that lets you name a column when you execute it. Maybe someone else can chime in if that's possible. David J. responded You cannot. By definition parameters, in this context, are values - not identifiers. [...] In both

Re: [GENERAL] ORDER BY in prepared statements

2015-01-21 Thread David Johnston
On Wed, Jan 21, 2015 at 4:09 PM, Bryn Jeffries bryn.jeffr...@sydney.edu.au wrote: Maybe what we need in ODBC libs and the like is a protected statement that follows the same construction as a prepared statement but additionally checks catalogs to validate identifiers. ​I'm not sure

Re: [GENERAL] ORDER BY in prepared statements

2015-01-21 Thread David Johnston
On Wed, Jan 21, 2015 at 4:09 PM, Bryn Jeffries bryn.jeffr...@sydney.edu.au wrote: Paul Jungwirth wrote I'm not sure how to make a prepared statement that lets you name a column when you execute it. Maybe someone else can chime in if that's possible. David J. responded You cannot. By

Re: [GENERAL] ORDER BY in prepared statements

2015-01-21 Thread Adrian Klaver
On 01/21/2015 03:09 PM, Bryn Jeffries wrote: Paul Jungwirth wrote I'm not sure how to make a prepared statement that lets you name a column when you execute it. Maybe someone else can chime in if that's possible. David J. responded You cannot. By definition parameters, in this context, are

Re: [GENERAL] BDR Error restarted

2015-01-21 Thread Craig Ringer
That's a lot of databases and explains why the logs were so busy. For the purpose of testing it would be interesting to simplify this case down, if you can, to the minimum required to reproduce the issue. It's awfully hard to keep track of what's going on with this many concurrent operations -

Re: [GENERAL] Concurrent Inserts

2015-01-21 Thread Albe Laurenz
sri harsha wrote: Is there any way to stop concurrent inserts to happen on a single table ?? If you really want that, it is easy with table locks. Actually i am using a FDW , in which the data is written into a single file. So when i do concurrent inserts , the data is written

Re: [GENERAL] Concurrent Inserts

2015-01-21 Thread sri harsha
Hi, Actually i am using a FDW , in which the data is written into a single file. So when i do concurrent inserts , the data is written into the file simultaneously and this is causing a data corruption . Is TABLE LOCK the only option available ?? --Harsha On Wed, Jan 21, 2015 at 3:22 PM,

Re: [GENERAL] BDR Error restarted

2015-01-21 Thread deans
Hi Andres, Any other conf should I list in addition to the bdr settings below? BDR Settings(replaced the real db name here): 1. on node 01, the replication src one: # Generic settings required for BDR max_replication_slots = 60 max_wal_senders = 60 wal_level = 'logical' track_commit_timestamp

[GENERAL] Concurrent Inserts

2015-01-21 Thread sri harsha
Hi, Is there any way to stop concurrent inserts to happen on a single table ?? Query 1 : INSERT INTO TABLE_A SELECT * FROM TABLE1; Query 2 : INSERT INTO TABLE_A SELECT * FROM TABLE2; Query 3 : SELECT * FROM TABLE_A; Assume i have the above queries. Query 1 and Query 3 can occur concurrently

Re: [GENERAL] Concurrent Inserts

2015-01-21 Thread Albe Laurenz
sri harsha wrote: Is there any way to stop concurrent inserts to happen on a single table ?? Query 1 : INSERT INTO TABLE_A SELECT * FROM TABLE1; Query 2 : INSERT INTO TABLE_A SELECT * FROM TABLE2; Query 3 : SELECT * FROM TABLE_A; Assume i have the above queries. Query 1 and Query 3 can

Re: [GENERAL] partitioning query planner almost always scans all tables

2015-01-21 Thread Spiros Ioannou
@Rob Sargent: sorry Rob, not sure what you are asking. @Kyotaro HORIGUCHI thanks for your reply and time Kyotaro, Using the following query EXPLAIN ANALYZE SELECT * FROM measurement_events WHERE measurement_source_id='df86917e-8df0-11e1-8f8f-525400e76ceb' AND measurement_time = '2015-01-01

[GENERAL] Fwd: Ask for a question

2015-01-21 Thread Pierre Hsieh
Hi, Would you please tell me whether PostgreSQL can execute the following tasks? If not, please also tell me which one can help me for that. Thanks -- *謝宗翰* *|* *台北富邦銀行* *風險管理部* *| 10686**台北市大安區仁愛路四段**169**號**12**樓**| (02) 27716699 **分機* *62853* *Pierre