Re: Is postgres able to share sorts required by common partition window functions?

2020-07-07 Thread Michael Lewis
On Monday, July 6, 2020, Michael Lewis wrote: > Did you say you have an index on c1? > [...] > I don't know the data, but I assume there may be many rows with the same > c1 value, so then you would likely benefit from getting that distinct set > first like below as your FROM table. > >

Re: Basic question about structuring SQL

2020-07-07 Thread David G. Johnston
On Tue, Jul 7, 2020 at 4:41 AM Robert Inder wrote: > So how should I structure my chunks of SQL so that I can have "safe" > (all-or-nothing) blocks, > AND use them from within one another? > While there are more advanced constructs that may aid here I would suggest just following two rules:

Re: Is postgres able to share sorts required by common partition window functions?

2020-07-07 Thread Sebastien Arod
Michael, David thanks for your quick replies. *@Michael* I initially dismissed writing this query using joins or subselects because the real query has about 80 columns and I was afraid that having 80 joins/subselect would cause issues with postgresql including planner that would fallback to

Re: Basic question about structuring SQL

2020-07-07 Thread Laurenz Albe
On Tue, 2020-07-07 at 12:40 +0100, Robert Inder wrote: > NOW, I want to do the same for a BIGGER task. > BUT I realise that if I create bigger-task.sql like this... >BEGIN; > <> >\i do-something-useful.sql > <> >COMMIT; > ...the COMMIT inside "do-something-useful.sql"

Re: Basic question about structuring SQL

2020-07-07 Thread Jason Wang
I don't think nested commit is supported however you might want to put logic in do-something-useful.sql into a stored procedure without commit and your BIGGER task just calls this SP and commits at the end; you can run the SP by itself to have transaction protected. /Jason On Tue, 7 Jul 2020 at

Basic question about structuring SQL

2020-07-07 Thread Robert Inder
I'm an experienced programmer but really new to SQL, and I'm wanting a pointer to "the SQL way" to structure/organise chunks of code. A while back, I wrote a chunk of SQL to Do Something Useful. I put it in a file (do-something-useful.sql). And, to protect against getting into a weird state, I

Transaction control in SECURITY DEFINER procedures

2020-07-07 Thread Chris Sterritt
The documentation for CREATE PROCEDURE informs us "A|SECURITY DEFINER|procedure cannot execute transaction control statements (for example,|COMMIT|and|ROLLBACK|, depending on the language)." Can anyone let me know why this is so and are there any plans to remove this restriction in future

Auto vacuum not reclaiming the space and disk utilization spike to 100%

2020-07-07 Thread Ishan Joshi
Hi Team, I am running Postgres v12.2 and in our testing we are running performance test for 72 hrs with load. During the run it is working fine till first 16hrs after that disk utilization getting spike and next 2-4 hrs it is reaching to 100%. During the run we are deleting 2 million records

SV: SV: Using Postgres jdbc driver with Oracle SQL Developer

2020-07-07 Thread Niels Jespersen
-Oprindelig meddelelse- >Fra: legrand legrand >Sendt: 6. juli 2020 17:36 >Til: pgsql-gene...@postgresql.org >Emne: Re: SV: Using Postgres jdbc driver with Oracle SQL Developer > >Try Replacing hostname by hostname/Database? >Don’t Forget ? > >Regards >Pascal Ha! Thats it!. Almost. Its