Thread: Thoughts on "Love Your Database"
I've long been frustrated with how most web developers I meet have no idea how to use an SQL database properly. I think I'mgoing to write a book called Love Your Database, aimed at web developers, that explains how to make their apps betterby leveraging the power of SQL in general, and Postgres in particular. I'm thinking of a section on features of SQL most folks don't know about (CTEs are *way* to hell at the top of that list,but also EXCEPT/INTERSECT and window functions), but much of the book would be about how to do things server side. Benchmarksshowing how much faster this can be, but mostly techniques — stored procedures/triggers/rules, views. I asked a colleague about the advice I often hear stated but seldom justified, that one shouldn't put business rules in thedatabase. He offered that server-side code can be hard to debug. I'm sure many here would love to see such a book published, maybe some talks on the topic given. What might I cover that I haven't mentioned? What are the usual objections to server-side code and how can they be met? When*are* they justified and what should the criteria be to put code in Postgres? Any other thoughts? Any other websitesor books on the topic I might consult? TIA
> owner@postgresql.org] On Behalf Of Guyren Howe > I've long been frustrated with how most web developers I meet have no idea > how to use an SQL database properly. I think I'm going to write a book called > Love Your Database, aimed at web developers, that explains how to make their > apps better by leveraging the power of SQL in general, and Postgres in > particular. > > I'm thinking of a section on features of SQL most folks don't know about > (CTEs are *way* to hell at the top of that list, but also EXCEPT/INTERSECT > and window functions), but much of the book would be about how to do things > server side. Benchmarks showing how much faster this can be, but mostly > techniques — stored procedures/triggers/rules, views. > > I asked a colleague about the advice I often hear stated but seldom > justified, that one shouldn't put business rules in the database. He offered > that server-side code can be hard to debug. > > I'm sure many here would love to see such a book published, maybe some talks > on the topic given. > > What might I cover that I haven't mentioned? What are the usual objections to > server-side code and how can they be met? When *are* they justified and what > should the criteria be to put code in Postgres? Any other thoughts? Any other > websites or books on the topic I might consult? I'm a strong believer in putting the business code next to the data, not the wrong side of the object-relational divide.However, for many the challenge of writing and debugging SQL code is just too high! The SQL language on many serverscan do everything but it's clunky, lacks modern language features, is hard to debug, often fragile and really hardto get right. The only thing I can give you that might help is a cookbook on how to do it right: http://thehelsinkideclaration.blogspot.com.au/2009/03/window-on-data-applications.html. Meanwhile I'm busy replacing SQL with Andl, which can do everything SQL gets right and avoids most of the things it getswrong. Look out for an implementation on Postgres real soon now. See http://www.andl.org/2016/04/postgres-meet-andl/. Regards David M Bennett FACS Andl - A New Database Language - andl.org
Good morning > -----Original Message----- > From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Guyren Howe > Sent: Mittwoch, 4. Mai 2016 06:11 > To: pgsql-general <pgsql-general@postgresql.org> > Subject: [GENERAL] Thoughts on "Love Your Database" > > I've long been frustrated with how most web developers I meet have no idea how to use an SQL database properly. I > think I'm going to write a book called Love Your Database, aimed at web developers, that explains how to make their > apps better by leveraging the power of SQL in general, and Postgres in particular. > > I'm thinking of a section on features of SQL most folks don't know about (CTEs are *way* to hell at the top of that > list, but also EXCEPT/INTERSECT and window functions), but much of the book would be about how to do things server > side. Benchmarks showing how much faster this can be, but mostly techniques — stored procedures/triggers/rules, > views. > > I asked a colleague about the advice I often hear stated but seldom justified, that one shouldn't put business rules > in the database. He offered that server-side code can be hard to debug. > > I'm sure many here would love to see such a book published, maybe some talks on the topic given. > > > What might I cover that I haven't mentioned? What are the usual objections to server-side code and how can they be > met? When *are* they justified and what should the criteria be to put code in Postgres? Any other thoughts? Any > other websites or books on the topic I might consult? If you have a complex design or if the processes require the modification of various tables within a transaction you mayprobably prefer to expose functions as the application interface. Advantages of this approach: - Hide complexity: You don't need to explain all the details, dependencies and implications to all web developers. Just makesure that your documentation is up-to-date for those who want to learn about it. - Transactions are controlled by the database: You may have doubts if application developers do handle this correctly. - Minimize the impact on application development: If changes to requirements force changes in the database, these would betransparent to the application. Even if the interface changes, that may mean only an additional argument to a function. - Security: You can grant execute on (security definer) functions instead of granting privileges for each object. The lattercan become quite complex. - Separation of concerns: Application developers don't need to (but can if they want) learn SQL. They should focus insteadon the presentation layer, which at the end is what customers see and sells. Bye Charles > > TIA > > -- > Sent via pgsql-general mailing list (pgsql-general@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-general
I've long been frustrated with how most web developers I meet have no idea how to use an SQL database properly. I think I'm going to write a book called Love Your Database, aimed at web developers, that explains how to make their apps better by leveraging the power of SQL in general, and Postgres in particular.
I'm thinking of a section on features of SQL most folks don't know about (CTEs are *way* to hell at the top of that list, but also EXCEPT/INTERSECT and window functions), but much of the book would be about how to do things server side. Benchmarks showing how much faster this can be, but mostly techniques — stored procedures/triggers/rules, views.
I asked a colleague about the advice I often hear stated but seldom justified, that one shouldn't put business rules in the database. He offered that server-side code can be hard to debug.
I'm sure many here would love to see such a book published, maybe some talks on the topic given.
What might I cover that I haven't mentioned? What are the usual objections to server-side code and how can they be met? When *are* they justified and what should the criteria be to put code in Postgres? Any other thoughts? Any other websites or books on the topic I might consult?
TIA
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
--
On Tue, 3 May 2016 23:11:06 -0500 Guyren Howe <guyren@gmail.com> wrote: > I've long been frustrated with how most web developers I meet have no idea how to use an SQL database properly. I thinkI'm going to write a book called Love Your Database, aimed at web developers, that explains how to make their apps betterby leveraging the power of SQL in general, and Postgres in particular. > > I'm thinking of a section on features of SQL most folks don't know about (CTEs are *way* to hell at the top of that list,but also EXCEPT/INTERSECT and window functions), but much of the book would be about how to do things server side. Benchmarksshowing how much faster this can be, but mostly techniques ? stored procedures/triggers/rules, views. > > I asked a colleague about the advice I often hear stated but seldom justified, that one shouldn't put business rules inthe database. He offered that server-side code can be hard to debug. > > I'm sure many here would love to see such a book published, maybe some talks on the topic given. > > > What might I cover that I haven't mentioned? What are the usual objections to server-side code and how can they be met?When *are* they justified and what should the criteria be to put code in Postgres? Any other thoughts? Any other websitesor books on the topic I might consult? Not a specific topic, but as a general theme, a lot of developers don't seem to think it's useful for them to know SQL, and therefore don't bother trying -- or even actively resist learning. So if the overall theme is "knowing this makes things better", I would buy multiple copies of the book an mysteriously leave it on various developer's desks. -- Bill Moran
On 4 May 2016 at 06:46, dandl <david@andl.org> wrote: > I'm a strong believer in putting the business code next to the data, not the wrong > side of the object-relational divide. However, for many the challenge of writing and > debugging SQL code is just too high! Your source for this statement please? "For many" sounds rather like weasel-words to me. In my experience, a wide range of people, from beginners to experts, find SQL easy to write and debug. I'm afraid that the problem seems to me to be that your peg is rather too square. > Meanwhile I'm busy replacing SQL with Andl, which can do everything SQL gets > right and avoids most of the things it gets wrong. Look out for an implementation > on Postgres real soon now. See http://www.andl.org/2016/04/postgres-meet-andl/. Please, can you stop spamming every marginally-related topic in the list with this? I'm sure that anyone who's interested in this will have seen it in the thread you created that was actually marked with it in the subject. Geoff
On 4 May 2016 at 06:46, dandl <david@andl.org> wrote:
> I'm a strong believer in putting the business code next to the data, not the wrong
> side of the object-relational divide. However, for many the challenge of writing and
> debugging SQL code is just too high!
Your source for this statement please? "For many" sounds rather like
weasel-words to me. In my experience, a wide range of people, from
beginners to experts, find SQL easy to write and debug. I'm afraid
that the problem seems to me to be that your peg is rather too square.
--
A few observationsOn Wed, May 4, 2016 at 12:31 PM, Geoff Winkless <pgsqladmin@geoff.dj> wrote:On 4 May 2016 at 06:46, dandl <david@andl.org> wrote:
> I'm a strong believer in putting the business code next to the data, not the wrong
> side of the object-relational divide. However, for many the challenge of writing and
> debugging SQL code is just too high!
Your source for this statement please? "For many" sounds rather like
weasel-words to me. In my experience, a wide range of people, from
beginners to experts, find SQL easy to write and debug. I'm afraid
that the problem seems to me to be that your peg is rather too square.I actually agree with dandl on this. Folks can write SQL but often aren't really comfortable using it as core application logic.I.e. one often sees code that retrieves a bunch of records from the db, loops through them, and transforms the data as part of the OLTP workflow. It is obviously much better of one can think about SQL as business logic but this is not that often.I.e. people think the peg is square but indeed it is round.
> owner@postgresql.org] On Behalf Of Geoff Winkless > > I'm a strong believer in putting the business code next to the data, > > not the wrong side of the object-relational divide. However, for many > > the challenge of writing and debugging SQL code is just too high! > > Your source for this statement please? "For many" sounds rather like weasel- > words to me. In my experience, a wide range of people, from beginners to > experts, find SQL easy to write and debug. I'm afraid that the problem seems > to me to be that your peg is rather too square. Then I think you've seriously misunderstood. Most people can indeed learn to write basic SQL queries, but those are (obviously)not what I'm talking about. To write the business logic of a significant application entirely in SQL requires PLSQL (or in other dialects, whatever passesfor SQL/PSM). It means writing an entire data access layer as a set of stored procedures, with a substantial set ofspecial functions, types, triggers and so on. No beginner and few experts have the skills required to do that in SQL, andthen debug that code on the server. The plain aim of Andl is make this task far, far easier so that indeed a beginnercan do it. > > Meanwhile I'm busy replacing SQL with Andl, which can do everything > > SQL gets right and avoids most of the things it gets wrong. Look out > > for an implementation on Postgres real soon now. See > http://www.andl.org/2016/04/postgres-meet-andl/. > > Please, can you stop spamming every marginally-related topic in the list with > this? I'm sure that anyone who's interested in this will have seen it in the > thread you created that was actually marked with it in the subject. The man asked a question and I gave him two links that provide specific parts of my answer. I think you would learn somethingfrom reading them, but perhaps the simplest solution is that you just ignore my posts in future. Regards David M Bennett FACS Andl - A New Database Language - andl.org
I've long been frustrated with how most web developers I meet have no idea how to use an SQL database properly. I think I'm going to write a book called Love Your Database, aimed at web developers, that explains how to make their apps better by leveraging the power of SQL in general, and Postgres in particular.
I'm thinking of a section on features of SQL most folks don't know about (CTEs are *way* to hell at the top of that list, but also EXCEPT/INTERSECT and window functions), but much of the book would be about how to do things server side. Benchmarks showing how much faster this can be, but mostly techniques — stored procedures/triggers/rules, views.
I asked a colleague about the advice I often hear stated but seldom justified, that one shouldn't put business rules in the database. He offered that server-side code can be hard to debug.
I'm sure many here would love to see such a book published, maybe some talks on the topic given.
What might I cover that I haven't mentioned? What are the usual objections to server-side code and how can they be met? When *are* they justified and what should the criteria be to put code in Postgres? Any other thoughts? Any other websites or books on the topic I might consult?
TIA
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Hi,
Hi,at my previous jobs I was working with many programmers, and almost none of them understood SQL. The problem was even deeper. They didn't want to learn it. When I was working among java programmers, I noticed that they hated SQL, but there was no problem with learning HQL, which in fact is quite similar. I really have no idea why it is like that.I was thinking about such a book too, I have even started writing that, but the whole set of ideas was always either too large or was a copy of what can be found in other, general programming books. And if programmers don't want to read the other books, and learn basics of SQL from there, then the whole idea seemed useless to me. Of course the other reason of not writing the book was lack of time, as writing a good book requires enormous amount of work.On the other hand I think that the huge problem with programmers and SQL is changing the mindset. A standard programmer usually has a problem with thinking in sets. Instead she usually thinks in terms of loops, and objects.
When I was giving talks about what not to do in databases, people were either not interested or everything was a surprise for them, even for quite experienced programmers. However after such a talk, or a training, people were still not interested in knowing more, but they were happily learning about programming.I think it would be great to have a book like that, and I think it should not be only about Postgres. But here is the problem I had with this concept: to describe all the things to a normal programmer, assuming she will be interested, it will need to be quite a huge and complicated book.Or maybe this book should be about something else, start from an ORM, and show how to translate it to much better SQL, as ORMs are the things programmers usually understand, and they really don't bother that using them can be a bad idea.--regards Szymon Lipiński
John McKown
On 4 May 2016 at 13:13, Chris Travers <chris.travers@gmail.com> wrote:A few observationsOn Wed, May 4, 2016 at 12:31 PM, Geoff Winkless <pgsqladmin@geoff.dj> wrote:On 4 May 2016 at 06:46, dandl <david@andl.org> wrote:
> I'm a strong believer in putting the business code next to the data, not the wrong
> side of the object-relational divide. However, for many the challenge of writing and
> debugging SQL code is just too high!
Your source for this statement please? "For many" sounds rather like
weasel-words to me. In my experience, a wide range of people, from
beginners to experts, find SQL easy to write and debug. I'm afraid
that the problem seems to me to be that your peg is rather too square.I actually agree with dandl on this. Folks can write SQL but often aren't really comfortable using it as core application logic.I.e. one often sees code that retrieves a bunch of records from the db, loops through them, and transforms the data as part of the OLTP workflow. It is obviously much better of one can think about SQL as business logic but this is not that often.I.e. people think the peg is square but indeed it is round.
From my perspective there is one more thing: when I tried, in couple of companies, to move some part of the logic to a database, then usually the management said "no, that's not doable, as we will have trouble with finding good sql programmers later", and we were still writing all the logic outside the database.
On 4 May 2016 at 12:36, Szymon Lipiński <mabewlun@gmail.com> wrote: > From my perspective there is one more thing: when I tried, in couple of > companies, to move some part of the logic to a database, then usually the > management said "no, that's not doable, as we will have trouble with finding > good sql programmers later", and we were still writing all the logic outside > the database. "Finding good programmers later" will always be hard. There are less of them about than Human Resources would like to believe. Putting your logic in a different layer or in a different language over the top of SQL doesn't mean you won't need good programmers later; quite the reverse, because now you need programmers who are both strong in SQL _and_ good enough to understand the layer you've added on top. On the other hand, if you're planning on putting _some_ of your logic into the database, then I probably see where they're coming from. If you give full database access to application developers (rather than providing them with stored procedures that perform the tasks for them) then they will be surprised as hell when the database does something they weren't expecting because of some business rules that are in a fourth-level trigger somewhere. The sensible way is to do it as John wrote - to restrict access rights to everyone except admin to calling functions only. That way the functions are written by the people who are paid to understand the business rules and the data behind it, and the application developers can ask those experts to do the heavy lifting for them. Having to persuade management that they should no longer be able to connect the database to MS Access and make changes that way will usually put an end to that pure model, though. :) Geoff
<snip>
The sensible way is to do it as John wrote - to restrict access rights
to everyone except admin to calling functions only. That way the
functions are written by the people who are paid to understand the
business rules and the data behind it, and the application developers
can ask those experts to do the heavy lifting for them. Having to
persuade management that they should no longer be able to connect the
database to MS Access and make changes that way will usually put an
end to that pure model, though. :)
Geoff
John McKown
<snip>
The sensible way is to do it as John wrote - to restrict access rights
to everyone except admin to calling functions only. That way the
functions are written by the people who are paid to understand the
business rules and the data behind it, and the application developers
can ask those experts to do the heavy lifting for them. Having to
persuade management that they should no longer be able to connect the
database to MS Access and make changes that way will usually put an
end to that pure model, though. :)Allowing PHBs direct access to company data is a nasty thing. They become like some users who "know Excel". They are now just as knowledgeable as someone who's been doing this for years. I've actually heard one say something akin to: "Damn it, I can write Excel formulas. I know very well that an new function on the web site could be written in less than a day, if you'd just get off you a$$ and do it."
Geoff--The unfacts, did we have them, are too imprecisely few to warrant our certitude.Maranatha! <><
John McKown
from the INFORMATION_SCHEMA would be a good start.
--
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.

Hi, Le 04/05/2016 13:36, Szymon Lipiński a écrit : > On 4 May 2016 at 13:13, Chris Travers <chris.travers@gmail.com > <mailto:chris.travers@gmail.com>> wrote: > A few observations > > On Wed, May 4, 2016 at 12:31 PM, Geoff Winkless <pgsqladmin@geoff.dj > <mailto:pgsqladmin@geoff.dj>> wrote: > > On 4 May 2016 at 06:46, dandl <david@andl.org > <mailto:david@andl.org>> wrote: > > I'm a strong believer in putting the business code next to the data, not the wrong > > side of the object-relational divide. However, for many the challenge of writing and > > debugging SQL code is just too high! > > Your source for this statement please? "For many" sounds rather like > weasel-words to me. In my experience, a wide range of people, from > beginners to experts, find SQL easy to write and debug. Yes, I agree. SQL is just crystal-clear to write, read and understand. I found out that debugging is usually not a common exercise in SQL, because the language is so trivial. ... > From my perspective there is one more thing: when I tried, in couple of > companies, to move some part of the logic to a database, then usually > the management said "no, that's not doable, as we will have trouble with > finding good sql programmers later", Shocking! Apart from very few languages I know, SQL is by far more productive and efficient, for many-many tasks. > and we were still writing all the logic outside the database. I used to implement the logic outside the database, like you mention, *but* I was writing plain SQL. Only when I had specific needs, then I would switch to another language which would just get the results from a well-polished plain SQL query, process, and feed back things into the database (with another well-polished SQL, of course) or just throw the results out somewhere else (file, screen, picture, whatever). No ORM or any complication. And I find SQL fairly easy to debug and maintain, no need for fancy tools: an editor and a console (psql or equivalent) and you're up and going! Nowadays, things got quite different, and I tend to stuff more and more logic inside the database. Which is often merely converting SQL queries into views... But it comes with a counterpart: the more you put logic inside your DBMS, the more dependent you become. As far as I'm concerned, I recently decided to just stick to PostgreSQL forever! (or almost) À+ Pierre PS: sorry for the double-reply, Szymon: I forgot *again* to hit Shift-Ctrl-R instead of Ctrl-R, shame on me... -- ____________________________________________________________________________ Pierre Chevalier PChGEI: Pierre Chevalier Géologue Et Informaticien Partenaire DALIBO Mesté Duran 32100 Condom Tél+fax : 09 75 27 45 62 06 37 80 33 64 Émail : pierrechevaliergeolCHEZfree.fr icq# : 10432285 jabber: pierre.chevalier1967@jabber.fr http://pierremariechevalier.free.fr/pierre_chevalier_geologue ____________________________________________________________________________
Le 04/05/2016 15:25, John McKown a écrit : > On Wed, May 4, 2016 at 8:13 AM, Geoff Winkless <pgsqladmin@geoff.dj > <mailto:pgsqladmin@geoff.dj>>wrote: > > <snip> > > The sensible way is to do it as John wrote - to restrict access rights > to everyone except admin to calling functions only. That way the > functions are written by the people who are paid to understand the > business rules and the data behind it, and the application developers > can ask those experts to do the heavy lifting for them. Having to > persuade management that they should no longer be able to connect the > database to MS Access and make changes that way will usually put an > end to that pure model, though. :) > > > Allowing PHBs direct access to company data is a nasty thing. Sorry, what is a PHB? Our friend google didn't help me much on this matter. > They become like some users who "know Excel". They are now just as > knowledgeable as someone who's been doing this for years. I've actually > heard one say something akin to: "Damn it, I can write Excel formulas. I > know very well that an new function on the web site could be written in > less than a day, if you'd just get off you a$$ and do it." Hm. Sounds familiar... I usually call "excelitis" a sort of mental disease related to a use and abuse of Excel, up to the point where one cannot imagine data which is *not* in a table-like array. And they think that they do Relational Database Management... In the 1990's, I met many-many deeply sick persons. I had been infected for a while, I must confess. À+ Pierre -- ____________________________________________________________________________ Pierre Chevalier PChGEI: Pierre Chevalier Géologue Et Informaticien Partenaire DALIBO Mesté Duran 32100 Condom Tél+fax : 09 75 27 45 62 06 37 80 33 64 Émail : pierrechevaliergeolCHEZfree.fr icq# : 10432285 jabber: pierre.chevalier1967@jabber.fr http://pierremariechevalier.free.fr/pierre_chevalier_geologue ____________________________________________________________________________
Le 04/05/2016 13:36, dandl a écrit : ... > Then I think you've seriously misunderstood. Most people can >indeed learn to write basic SQL queries, but those are >(obviously) not what I'm talking about. > > To write the business logic of a significant application >entirely in SQL requires PLSQL (or in other dialects, whatever >passes for SQL/PSM). It means writing an entire data access >layer as a set of stored procedures, with a substantial set of >special functions, types, triggers and so on. No beginner and >few experts have the skills required to do that in SQL, and then >debug that code on the server. All right, I understand better now. I think I also totally missed your point, sorry... I'll give a look at andl. À+ Pierre -- ____________________________________________________________________________ Pierre Chevalier PChGEI: Pierre Chevalier Géologue Et Informaticien Partenaire DALIBO Mesté Duran 32100 Condom Tél+fax : 09 75 27 45 62 06 37 80 33 64 Émail : pierrechevaliergeolCHEZfree.fr icq# : 10432285 jabber: pierre.chevalier1967@jabber.fr http://pierremariechevalier.free.fr/pierre_chevalier_geologue ____________________________________________________________________________
I've long been frustrated with how most web developers I meet have no idea how to use an SQL database properly. I think I'm going to write a book called Love Your Database, aimed at web developers, that explains how to make their apps better by leveraging the power of SQL in general, and Postgres in particular.
I'm thinking of a section on features of SQL most folks don't know about (CTEs are *way* to hell at the top of that list, but also EXCEPT/INTERSECT and window functions), but much of the book would be about how to do things server side. Benchmarks showing how much faster this can be, but mostly techniques — stored procedures/triggers/rules, views.
I asked a colleague about the advice I often hear stated but seldom justified, that one shouldn't put business rules in the database. He offered that server-side code can be hard to debug.
I'm sure many here would love to see such a book published, maybe some talks on the topic given.
What might I cover that I haven't mentioned? What are the usual objections to server-side code and how can they be met? When *are* they justified and what should the criteria be to put code in Postgres? Any other thoughts? Any other websites or books on the topic I might consult?
TIA
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
I've long been frustrated with how most web developers I meet have no idea how to use an SQL database properly. I think I'm going to write a book called Love Your Database, aimed at web developers, that explains how to make their apps better by leveraging the power of SQL in general, and Postgres in particular.
I'm thinking of a section on features of SQL most folks don't know about (CTEs are *way* to hell at the top of that list, but also EXCEPT/INTERSECT and window functions), but much of the book would be about how to do things server side. Benchmarks showing how much faster this can be, but mostly techniques — stored procedures/triggers/rules, views.
I asked a colleague about the advice I often hear stated but seldom justified, that one shouldn't put business rules in the database. He offered that server-side code can be hard to debug.
I'm sure many here would love to see such a book published, maybe some talks on the topic given.
What might I cover that I haven't mentioned? What are the usual objections to server-side code and how can they be met? When *are* they justified and what should the criteria be to put code in Postgres? Any other thoughts? Any other websites or books on the topic I might consult?
TIA
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Le 04/05/2016 15:25, John McKown a écrit :On Wed, May 4, 2016 at 8:13 AM, Geoff Winkless <pgsqladmin@geoff.dj
<mailto:pgsqladmin@geoff.dj>>wrote:
<snip>
The sensible way is to do it as John wrote - to restrict access rights
to everyone except admin to calling functions only. That way the
functions are written by the people who are paid to understand the
business rules and the data behind it, and the application developers
can ask those experts to do the heavy lifting for them. Having to
persuade management that they should no longer be able to connect the
database to MS Access and make changes that way will usually put an
end to that pure model, though. :)
Allowing PHBs direct access to company data is a nasty thing.
Sorry, what is a PHB? Our friend google didn't help me much on this matter.They become like some users who "know Excel". They are now just as
knowledgeable as someone who's been doing this for years. I've actually
heard one say something akin to: "Damn it, I can write Excel formulas. I
know very well that an new function on the web site could be written in
less than a day, if you'd just get off you a$$ and do it."
Hm. Sounds familiar...
I usually call "excelitis" a sort of mental disease related to a use and abuse of Excel, up to the point where one cannot imagine data which is *not* in a table-like array. And they think that they do Relational Database Management... In the 1990's, I met many-many deeply sick persons. I had been infected for a while, I must confess.
À+
Pierre
--
____________________________________________________________________________
Pierre Chevalier
PChGEI: Pierre Chevalier Géologue Et Informaticien
Partenaire DALIBO
Mesté Duran
32100 Condom
Tél+fax : 09 75 27 45 62
06 37 80 33 64
Émail : pierrechevaliergeolCHEZfree.fr
icq# : 10432285
jabber: pierre.chevalier1967@jabber.fr
http://pierremariechevalier.free.fr/pierre_chevalier_geologue
____________________________________________________________________________--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
First, you hit them over the head with a copy of "SQL Antipatterns: Avoiding the Pitfalls of Database Programming". It is a tad out of date and tends to use PHP and MySQL for the main examples but does also address different solutions available in PostgreSQL, Oracle. MS SQL server, etc. while pointing out the risks of various common foot-guns and providing alternatives.Or point them to this recent Linux Journal article by Reuven Lerner (who is occasionally seen on these lists):Developers often have a pre-Gallileo world view that they and whatever app they are coding is the center of the universe and databases, networks, storage and the rest all revolve around them existing only to support their app.But ultimately the church of the developer gets forced into the modern era and finds that the data is at the center and the apps that allow input, maintenance, extraction and analysis all revolve around those core crown jewels. Then, *gasp*, there are other people and apps touching "your" data. Are they all validating the data the way you do? Protecting it? Retrieving it efficiently? Only then does the real value of the database come into focus.Cheers,SteveOn Tue, May 3, 2016 at 9:11 PM, Guyren Howe <guyren@gmail.com> wrote:I've long been frustrated with how most web developers I meet have no idea how to use an SQL database properly. I think I'm going to write a book called Love Your Database, aimed at web developers, that explains how to make their apps better by leveraging the power of SQL in general, and Postgres in particular.
I'm thinking of a section on features of SQL most folks don't know about (CTEs are *way* to hell at the top of that list, but also EXCEPT/INTERSECT and window functions), but much of the book would be about how to do things server side. Benchmarks showing how much faster this can be, but mostly techniques — stored procedures/triggers/rules, views.
I asked a colleague about the advice I often hear stated but seldom justified, that one shouldn't put business rules in the database. He offered that server-side code can be hard to debug.
I'm sure many here would love to see such a book published, maybe some talks on the topic given.
What might I cover that I haven't mentioned? What are the usual objections to server-side code and how can they be met? When *are* they justified and what should the criteria be to put code in Postgres? Any other thoughts? Any other websites or books on the topic I might consult?
TIA
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Le 04/05/2016 15:25, John McKown a écrit :On Wed, May 4, 2016 at 8:13 AM, Geoff Winkless <pgsqladmin@geoff.dj
<mailto:pgsqladmin@geoff.dj>>wrote:
<snip>
The sensible way is to do it as John wrote - to restrict access rights
to everyone except admin to calling functions only. That way the
functions are written by the people who are paid to understand the
business rules and the data behind it, and the application developers
can ask those experts to do the heavy lifting for them. Having to
persuade management that they should no longer be able to connect the
database to MS Access and make changes that way will usually put an
end to that pure model, though. :)
Allowing PHBs direct access to company data is a nasty thing.
Sorry, what is a PHB? Our friend google didn't help me much on this matter.
They become like some users who "know Excel". They are now just as
knowledgeable as someone who's been doing this for years. I've actually
heard one say something akin to: "Damn it, I can write Excel formulas. I
know very well that an new function on the web site could be written in
less than a day, if you'd just get off you a$$ and do it."
Hm. Sounds familiar...
I usually call "excelitis" a sort of mental disease related to a use and abuse of Excel, up to the point where one cannot imagine data which is *not* in a table-like array. And they think that they do Relational Database Management... In the 1990's, I met many-many deeply sick persons. I had been infected for a while, I must confess.
À+
Pierre
John McKown
On 05/03/2016 09:11 PM, Guyren Howe wrote: > I think I'm going to write a book called Love Your Database, aimed at web developers > > What might I cover that I haven't mentioned? What are the usual objections to server-side code and how can they be met?When *are* they justified and what should the criteria be to put code in Postgres? Any other thoughts? Any other websitesor books on the topic I might consult? I gave a talk here about doing "interesting" Postgres things in Rails: https://github.com/pjungwir/rails-and-sql-talk I don't think that will satisfy many people on this list advocating for stored procedures, but it is an example of trying to teach what SQL can do, and how you can do those things without losing your convenient and familiar ORM tools, e.g. running a query and getting back a bunch of Ruby objects. I was not really happy with the talk to be honest. I felt it lacked unity, it didn't fit in the time I had, and it was too split between "for beginners" and advanced stuff. It was just snippets---in other words CTEs and window functions :-). I would like to see something that offers more strategic advice. Give me a plan. I would be very interested in that book. I think the biggest challenge will be identifying with your audience: knowing their priorities and concerns and workflows. My take on the last 25 years of software architecture theory is "how to put a layer in front of my database." I think most people who want business logic in the database are dismissive of this work and too derogatory toward typical web developers, so I would be pleased to see a book that takes that history more seriously. You aren't going to convince the world to trade Rails for PLSQL. But are there ways I can use SQL (and PLSQL) without giving up Rails? How will I maintain that stuff? Does it play nice with Rails database migrations? How will I write tests for it? How do I debug it? What principles will help me draw the line between (PL)SQL and Ruby? Good luck! I think a book like that would be great. Paul
On 4 May 2016 at 17:08, John McKown <john.archie.mckown@gmail.com> wrote: > I had a manager, long ago, who used a Lotus 1-2-3 spreadsheet to > contain all his memos. I was glassy eyed in disbelief. He also would use his > hand calculator to add up the numbers in the spreadsheet to be sure that the > summation function in the spreadsheet didn't make a mistake. <shudder/> That still happens - we have a few live examples around in this company. Unfortunately they're not caged and there's no sign "Do not feed the managers". Admittedly, they're using Excel instead of Lotus-1-2-3, but that's the only difference. -- If you can't see the forest for the trees, Cut the trees and you'll see there is no forest.
The reality is somewhere in the middle as it often is. My point is you don't have to replace a million lines of code if you plan upfront. If you don't .. you do.
On Wed, May 04, 2016 11:05:25 AM Will McCormick wrote:
A reason to consider may be portability. What happens if I want to let my customer chose their data store or I just don't want to put all my eggs in one basket.Technically there are truths but you cannot ignore the business side either. If a we can exceed our performance requirements and keep things generic/portable this is the best of both worlds.I think this is the main reason people separate the business logic from the database. How many of you have ported databases between platforms? Or had multiple types of data stores in the same company?
I have been waiting for the portability argument for the last 20+ posts :-) Everyone who did any type of consulting/working in this field knows that latest the second argument from management is “portability”. I have yet to see anyone who really needed to move to a different database. If they did it usually is a political issue and not a technical one (uhh, we hired this new operations manager and MS SQL is so much better than postgresql …) Unless you develop a generic software to be sold to many clients, the choice of data storage is rarely a real concern unless someone who feels the urge to be important starts throwing words he read in a magazine at management. None of my clients ever questioned the database. They either had one which they wanted to use (i.e. they had a big iron IBM with DB2 on it plus a DBA who knew what he was doing) or they didn't care as long as it worked as expected and came with a maintenance contract of sorts.
If you're developing a web application, the least concern is portability (you're not going to replace the million lines of PHP either). The biggest concern should lie with data integrity and API's that protect your data and business logic so you can hire that cheap app development company from overseas your boss recommended (based on a spam email) without running the risk of compromising everything.
Uwe
On 4 May 2016 at 17:14, Will McCormick <wmccormick@gmail.com> wrote: > Examples: Companies buy other companies - You are using a competitors data store and want to replace it. Company needsto compete with competitors and wants to reduce cost ... Or, let's say, massive multibillion-dollar DBMS competitor buys smaller but very popular DBMS and steadily increases license costs to try to price out that database and force its customers to its own, extortionately expensive, database. Completely hypothetically, of course. > The reality is somewhere in the middle as it often is. My point is you don't have to replace a million lines of code ifyou plan upfront. If you don't .. you do. Chances are you do anyway. Since no engine is perfect, at some point you will (assuming it's a non-trivial store) have had to have made modifications to the data structures or the queries you run to optimise to a particular DBMS. But you're right, if you've started out well, it will at least minimise the amount of change. Geoff
I agree it's typically political but so are most things business. Examples: Companies buy other companies - You are using a competitors data store and want to replace it. Company needs to compete with competitors and wants to reduce cost ... these are not technical requirements and it's certainly not vapor ideology. I have only worked for startups and have seen this happen at every company i have worked for, yes it is political but yes it happens. Smaller companies are more susceptible to it.
The reality is somewhere in the middle as it often is. My point is you don't have to replace a million lines of code if you plan upfront. If you don't .. you do.On Wed, May 4, 2016 at 11:29 AM, Uwe Schroeder <uwe@oss4u.com> wrote:On Wed, May 04, 2016 11:05:25 AM Will McCormick wrote:
A reason to consider may be portability. What happens if I want to let my customer chose their data store or I just don't want to put all my eggs in one basket.Technically there are truths but you cannot ignore the business side either. If a we can exceed our performance requirements and keep things generic/portable this is the best of both worlds.I think this is the main reason people separate the business logic from the database. How many of you have ported databases between platforms? Or had multiple types of data stores in the same company?
I have been waiting for the portability argument for the last 20+ posts :-) Everyone who did any type of consulting/working in this field knows that latest the second argument from management is “portability”. I have yet to see anyone who really needed to move to a different database. If they did it usually is a political issue and not a technical one (uhh, we hired this new operations manager and MS SQL is so much better than postgresql …) Unless you develop a generic software to be sold to many clients, the choice of data storage is rarely a real concern unless someone who feels the urge to be important starts throwing words he read in a magazine at management. None of my clients ever questioned the database. They either had one which they wanted to use (i.e. they had a big iron IBM with DB2 on it plus a DBA who knew what he was doing) or they didn't care as long as it worked as expected and came with a maintenance contract of sorts.
If you're developing a web application, the least concern is portability (you're not going to replace the million lines of PHP either). The biggest concern should lie with data integrity and API's that protect your data and business logic so you can hire that cheap app development company from overseas your boss recommended (based on a spam email) without running the risk of compromising everything.
Uwe
On 05/04/2016 08:39 AM, Paul Jungwirth wrote: > On 05/03/2016 09:11 PM, Guyren Howe wrote: >> I think I'm going to write a book called Love Your Database, aimed at >> web developers > > I gave a talk here about doing "interesting" Postgres things in Rails: Oh also: one part of my talk I did like what giving my mental process for building up a query. Because of SQL's declarative nature, a lot of people just don't know where to start. My own thinking goes like this: 1. Each output row is a _____. 2. Use that for the `FROM`. From there, it is easy to JOIN to whatever else I need, add filters, and fill in the SELECT. That's worked really well for me. I'd love to hear what other people do, if you've done any reflection on your own thought process. I think teaching this is a different thing than just teaching SQL syntax. I haven't seen it written about a lot. It must be somewhere, but any book encouraging "outsiders" to use more SQL could benefit from giving them direction like that. Paul
I'm not sure that when a company buys another company they can just migrate the other database without any logic layer. The data is usually useless without the business layer which tells how to merge all the parts together to have a simple answer to a question like "do we have this in stock". And for such a migration that's not too important if we have the logic in database, or in some other layer. Of course it is always simpler to migrate a database treated like a CSV file, where all the logic (including constraints) is in an external application. But do we really want that?On 4 May 2016 at 18:14, Will McCormick <wmccormick@gmail.com> wrote:I agree it's typically political but so are most things business. Examples: Companies buy other companies - You are using a competitors data store and want to replace it. Company needs to compete with competitors and wants to reduce cost ... these are not technical requirements and it's certainly not vapor ideology. I have only worked for startups and have seen this happen at every company i have worked for, yes it is political but yes it happens. Smaller companies are more susceptible to it.
The reality is somewhere in the middle as it often is. My point is you don't have to replace a million lines of code if you plan upfront. If you don't .. you do.On Wed, May 4, 2016 at 11:29 AM, Uwe Schroeder <uwe@oss4u.com> wrote:On Wed, May 04, 2016 11:05:25 AM Will McCormick wrote:
A reason to consider may be portability. What happens if I want to let my customer chose their data store or I just don't want to put all my eggs in one basket.Technically there are truths but you cannot ignore the business side either. If a we can exceed our performance requirements and keep things generic/portable this is the best of both worlds.I think this is the main reason people separate the business logic from the database. How many of you have ported databases between platforms? Or had multiple types of data stores in the same company?
I have been waiting for the portability argument for the last 20+ posts :-) Everyone who did any type of consulting/working in this field knows that latest the second argument from management is “portability”. I have yet to see anyone who really needed to move to a different database. If they did it usually is a political issue and not a technical one (uhh, we hired this new operations manager and MS SQL is so much better than postgresql …) Unless you develop a generic software to be sold to many clients, the choice of data storage is rarely a real concern unless someone who feels the urge to be important starts throwing words he read in a magazine at management. None of my clients ever questioned the database. They either had one which they wanted to use (i.e. they had a big iron IBM with DB2 on it plus a DBA who knew what he was doing) or they didn't care as long as it worked as expected and came with a maintenance contract of sorts.
If you're developing a web application, the least concern is portability (you're not going to replace the million lines of PHP either). The biggest concern should lie with data integrity and API's that protect your data and business logic so you can hire that cheap app development company from overseas your boss recommended (based on a spam email) without running the risk of compromising everything.
Uwe
On the other hand, when I was trying to store all my logic in a database, there was just one thing that made me hate it. Testing. Testing the procedures inside the database was not easy, not funny, and too much time consuming.--regards Szymon Lipiński
I agree that it's not like turning on the light switch. And I'm not implying there isn't a logic layer between the database and the application. Based off my past experiences I would likely not put business logic in the database unless it was a critical for performance. This does not make it portable and does the performance of my product require it? It really comes down to the application there is not one big paint brush. We have all be around and get this. I would not likely design a solution that had the database and the application layers both containing the business logic. I have seen this and the unexpected behavior as assumptions are made on both ends of that spectrum. I like to keep it simple where I can. This all being said I think database minded folks should own DAO's. I think if your a database guy and you don't own the DAO's you are missing an opportunity to really make a difference and get more aligned with your development staff. Doesn't matter what code base DAO's are in it's a repetitive pattern that any database person can pick up.On Wed, May 4, 2016 at 12:29 PM, Szymon Lipiński <mabewlun@gmail.com> wrote:I'm not sure that when a company buys another company they can just migrate the other database without any logic layer. The data is usually useless without the business layer which tells how to merge all the parts together to have a simple answer to a question like "do we have this in stock". And for such a migration that's not too important if we have the logic in database, or in some other layer. Of course it is always simpler to migrate a database treated like a CSV file, where all the logic (including constraints) is in an external application. But do we really want that?On 4 May 2016 at 18:14, Will McCormick <wmccormick@gmail.com> wrote:I agree it's typically political but so are most things business. Examples: Companies buy other companies - You are using a competitors data store and want to replace it. Company needs to compete with competitors and wants to reduce cost ... these are not technical requirements and it's certainly not vapor ideology. I have only worked for startups and have seen this happen at every company i have worked for, yes it is political but yes it happens. Smaller companies are more susceptible to it.
The reality is somewhere in the middle as it often is. My point is you don't have to replace a million lines of code if you plan upfront. If you don't .. you do.On Wed, May 4, 2016 at 11:29 AM, Uwe Schroeder <uwe@oss4u.com> wrote:On Wed, May 04, 2016 11:05:25 AM Will McCormick wrote:
A reason to consider may be portability. What happens if I want to let my customer chose their data store or I just don't want to put all my eggs in one basket.Technically there are truths but you cannot ignore the business side either. If a we can exceed our performance requirements and keep things generic/portable this is the best of both worlds.I think this is the main reason people separate the business logic from the database. How many of you have ported databases between platforms? Or had multiple types of data stores in the same company?
I have been waiting for the portability argument for the last 20+ posts :-) Everyone who did any type of consulting/working in this field knows that latest the second argument from management is “portability”. I have yet to see anyone who really needed to move to a different database. If they did it usually is a political issue and not a technical one (uhh, we hired this new operations manager and MS SQL is so much better than postgresql …) Unless you develop a generic software to be sold to many clients, the choice of data storage is rarely a real concern unless someone who feels the urge to be important starts throwing words he read in a magazine at management. None of my clients ever questioned the database. They either had one which they wanted to use (i.e. they had a big iron IBM with DB2 on it plus a DBA who knew what he was doing) or they didn't care as long as it worked as expected and came with a maintenance contract of sorts.
If you're developing a web application, the least concern is portability (you're not going to replace the million lines of PHP either). The biggest concern should lie with data integrity and API's that protect your data and business logic so you can hire that cheap app development company from overseas your boss recommended (based on a spam email) without running the risk of compromising everything.
Uwe
On the other hand, when I was trying to store all my logic in a database, there was just one thing that made me hate it. Testing. Testing the procedures inside the database was not easy, not funny, and too much time consuming.--regards Szymon Lipiński
I also wouldn't keep the logic in a database. And the DAO layer is the best solution I know. The biggest problem I experienced was that there was no DBA in a team, management didn't see any problem with that, and the DAO layer was managed by random programmers who didn't want to learn databases. The results were mainly two: slow development (due to too many bugs), and slow application (due to bad queries).On 4 May 2016 at 19:09, Will McCormick <wmccormick@gmail.com> wrote:I agree that it's not like turning on the light switch. And I'm not implying there isn't a logic layer between the database and the application. Based off my past experiences I would likely not put business logic in the database unless it was a critical for performance. This does not make it portable and does the performance of my product require it? It really comes down to the application there is not one big paint brush. We have all be around and get this. I would not likely design a solution that had the database and the application layers both containing the business logic. I have seen this and the unexpected behavior as assumptions are made on both ends of that spectrum. I like to keep it simple where I can. This all being said I think database minded folks should own DAO's. I think if your a database guy and you don't own the DAO's you are missing an opportunity to really make a difference and get more aligned with your development staff. Doesn't matter what code base DAO's are in it's a repetitive pattern that any database person can pick up.On Wed, May 4, 2016 at 12:29 PM, Szymon Lipiński <mabewlun@gmail.com> wrote:I'm not sure that when a company buys another company they can just migrate the other database without any logic layer. The data is usually useless without the business layer which tells how to merge all the parts together to have a simple answer to a question like "do we have this in stock". And for such a migration that's not too important if we have the logic in database, or in some other layer. Of course it is always simpler to migrate a database treated like a CSV file, where all the logic (including constraints) is in an external application. But do we really want that?On 4 May 2016 at 18:14, Will McCormick <wmccormick@gmail.com> wrote:I agree it's typically political but so are most things business. Examples: Companies buy other companies - You are using a competitors data store and want to replace it. Company needs to compete with competitors and wants to reduce cost ... these are not technical requirements and it's certainly not vapor ideology. I have only worked for startups and have seen this happen at every company i have worked for, yes it is political but yes it happens. Smaller companies are more susceptible to it.
The reality is somewhere in the middle as it often is. My point is you don't have to replace a million lines of code if you plan upfront. If you don't .. you do.On Wed, May 4, 2016 at 11:29 AM, Uwe Schroeder <uwe@oss4u.com> wrote:On Wed, May 04, 2016 11:05:25 AM Will McCormick wrote:
A reason to consider may be portability. What happens if I want to let my customer chose their data store or I just don't want to put all my eggs in one basket.Technically there are truths but you cannot ignore the business side either. If a we can exceed our performance requirements and keep things generic/portable this is the best of both worlds.I think this is the main reason people separate the business logic from the database. How many of you have ported databases between platforms? Or had multiple types of data stores in the same company?
I have been waiting for the portability argument for the last 20+ posts :-) Everyone who did any type of consulting/working in this field knows that latest the second argument from management is “portability”. I have yet to see anyone who really needed to move to a different database. If they did it usually is a political issue and not a technical one (uhh, we hired this new operations manager and MS SQL is so much better than postgresql …) Unless you develop a generic software to be sold to many clients, the choice of data storage is rarely a real concern unless someone who feels the urge to be important starts throwing words he read in a magazine at management. None of my clients ever questioned the database. They either had one which they wanted to use (i.e. they had a big iron IBM with DB2 on it plus a DBA who knew what he was doing) or they didn't care as long as it worked as expected and came with a maintenance contract of sorts.
If you're developing a web application, the least concern is portability (you're not going to replace the million lines of PHP either). The biggest concern should lie with data integrity and API's that protect your data and business logic so you can hire that cheap app development company from overseas your boss recommended (based on a spam email) without running the risk of compromising everything.
Uwe
On the other hand, when I was trying to store all my logic in a database, there was just one thing that made me hate it. Testing. Testing the procedures inside the database was not easy, not funny, and too much time consuming.--regards Szymon LipińskiIt seems like there is no problem with storing logic anywhere, the problem is with having someone who knows how to write it.--regards Szymon Lipiński
I 100% agree with you. It's always been a problem but it is up to us to take ownership and provide value. Some would be surprising shocked how simple it is to manage the Data access layer once the framework is in place regardless of what it is written in. For the same reasons you wouldn't typically have Application Developers configuring your production disks for high performance... why would you ever have them access the database inefficiently? There is an assumption designers are good at SQL or at least know it ... I challenge you to flip that around and learn the Data Access Layer. Companies do not knowingly spend money on hardware to have it consumed by inefficient data access? No executive signs up to increase the TCO and reduce profit margins when they could be making more money? But this is far to often the case and the root cause is they did not have the right tool (pun not intended) for the job.On Wed, May 4, 2016 at 1:33 PM, Szymon Lipiński <mabewlun@gmail.com> wrote:I also wouldn't keep the logic in a database. And the DAO layer is the best solution I know. The biggest problem I experienced was that there was no DBA in a team, management didn't see any problem with that, and the DAO layer was managed by random programmers who didn't want to learn databases. The results were mainly two: slow development (due to too many bugs), and slow application (due to bad queries).On 4 May 2016 at 19:09, Will McCormick <wmccormick@gmail.com> wrote:I agree that it's not like turning on the light switch. And I'm not implying there isn't a logic layer between the database and the application. Based off my past experiences I would likely not put business logic in the database unless it was a critical for performance. This does not make it portable and does the performance of my product require it? It really comes down to the application there is not one big paint brush. We have all be around and get this. I would not likely design a solution that had the database and the application layers both containing the business logic. I have seen this and the unexpected behavior as assumptions are made on both ends of that spectrum. I like to keep it simple where I can. This all being said I think database minded folks should own DAO's. I think if your a database guy and you don't own the DAO's you are missing an opportunity to really make a difference and get more aligned with your development staff. Doesn't matter what code base DAO's are in it's a repetitive pattern that any database person can pick up.On Wed, May 4, 2016 at 12:29 PM, Szymon Lipiński <mabewlun@gmail.com> wrote:I'm not sure that when a company buys another company they can just migrate the other database without any logic layer. The data is usually useless without the business layer which tells how to merge all the parts together to have a simple answer to a question like "do we have this in stock". And for such a migration that's not too important if we have the logic in database, or in some other layer. Of course it is always simpler to migrate a database treated like a CSV file, where all the logic (including constraints) is in an external application. But do we really want that?On 4 May 2016 at 18:14, Will McCormick <wmccormick@gmail.com> wrote:I agree it's typically political but so are most things business. Examples: Companies buy other companies - You are using a competitors data store and want to replace it. Company needs to compete with competitors and wants to reduce cost ... these are not technical requirements and it's certainly not vapor ideology. I have only worked for startups and have seen this happen at every company i have worked for, yes it is political but yes it happens. Smaller companies are more susceptible to it.
The reality is somewhere in the middle as it often is. My point is you don't have to replace a million lines of code if you plan upfront. If you don't .. you do.On Wed, May 4, 2016 at 11:29 AM, Uwe Schroeder <uwe@oss4u.com> wrote:On Wed, May 04, 2016 11:05:25 AM Will McCormick wrote:
A reason to consider may be portability. What happens if I want to let my customer chose their data store or I just don't want to put all my eggs in one basket.Technically there are truths but you cannot ignore the business side either. If a we can exceed our performance requirements and keep things generic/portable this is the best of both worlds.I think this is the main reason people separate the business logic from the database. How many of you have ported databases between platforms? Or had multiple types of data stores in the same company?
I have been waiting for the portability argument for the last 20+ posts :-) Everyone who did any type of consulting/working in this field knows that latest the second argument from management is “portability”. I have yet to see anyone who really needed to move to a different database. If they did it usually is a political issue and not a technical one (uhh, we hired this new operations manager and MS SQL is so much better than postgresql …) Unless you develop a generic software to be sold to many clients, the choice of data storage is rarely a real concern unless someone who feels the urge to be important starts throwing words he read in a magazine at management. None of my clients ever questioned the database. They either had one which they wanted to use (i.e. they had a big iron IBM with DB2 on it plus a DBA who knew what he was doing) or they didn't care as long as it worked as expected and came with a maintenance contract of sorts.
If you're developing a web application, the least concern is portability (you're not going to replace the million lines of PHP either). The biggest concern should lie with data integrity and API's that protect your data and business logic so you can hire that cheap app development company from overseas your boss recommended (based on a spam email) without running the risk of compromising everything.
Uwe
On the other hand, when I was trying to store all my logic in a database, there was just one thing that made me hate it. Testing. Testing the procedures inside the database was not easy, not funny, and too much time consuming.--regards Szymon LipińskiIt seems like there is no problem with storing logic anywhere, the problem is with having someone who knows how to write it.--regards Szymon Lipiński
You forgot that it is intended, there is the mantra "developers are expensive, hardware is cheap".
On May 4, 2016, at 11:59 , Paul Jungwirth <pj@illuminatedcomputing.com> wrote: > > I think teaching this is a different thing than just teaching SQL syntax. I haven't seen it written about a lot. It mustbe somewhere, but any book encouraging "outsiders" to use more SQL could benefit from giving them direction like that. I've never seen relational databases explained properly for beginners. I did a pretty successful boot camp two-week database course where it was heavily built around set operations. I startedwith a simple query on a table, then we went into all the cool things you could do to combine queries using UNION,INTERSECT and EXCEPT. To this day, I hardly ever see set operations used in SQL, and oftentimes when you have a hardquery to write, set operations are the natural expression. Anyhow.
You forgot that it is intended, there is the mantra "developers are expensive, hardware is cheap".On 4 May 2016 at 20:20, Will McCormick <wmccormick@gmail.com> wrote:I 100% agree with you. It's always been a problem but it is up to us to take ownership and provide value. Some would be surprising shocked how simple it is to manage the Data access layer once the framework is in place regardless of what it is written in. For the same reasons you wouldn't typically have Application Developers configuring your production disks for high performance... why would you ever have them access the database inefficiently? There is an assumption designers are good at SQL or at least know it ... I challenge you to flip that around and learn the Data Access Layer. Companies do not knowingly spend money on hardware to have it consumed by inefficient data access? No executive signs up to increase the TCO and reduce profit margins when they could be making more money? But this is far to often the case and the root cause is they did not have the right tool (pun not intended) for the job.On Wed, May 4, 2016 at 1:33 PM, Szymon Lipiński <mabewlun@gmail.com> wrote:I also wouldn't keep the logic in a database. And the DAO layer is the best solution I know. The biggest problem I experienced was that there was no DBA in a team, management didn't see any problem with that, and the DAO layer was managed by random programmers who didn't want to learn databases. The results were mainly two: slow development (due to too many bugs), and slow application (due to bad queries).On 4 May 2016 at 19:09, Will McCormick <wmccormick@gmail.com> wrote:I agree that it's not like turning on the light switch. And I'm not implying there isn't a logic layer between the database and the application. Based off my past experiences I would likely not put business logic in the database unless it was a critical for performance. This does not make it portable and does the performance of my product require it? It really comes down to the application there is not one big paint brush. We have all be around and get this. I would not likely design a solution that had the database and the application layers both containing the business logic. I have seen this and the unexpected behavior as assumptions are made on both ends of that spectrum. I like to keep it simple where I can. This all being said I think database minded folks should own DAO's. I think if your a database guy and you don't own the DAO's you are missing an opportunity to really make a difference and get more aligned with your development staff. Doesn't matter what code base DAO's are in it's a repetitive pattern that any database person can pick up.On Wed, May 4, 2016 at 12:29 PM, Szymon Lipiński <mabewlun@gmail.com> wrote:I'm not sure that when a company buys another company they can just migrate the other database without any logic layer. The data is usually useless without the business layer which tells how to merge all the parts together to have a simple answer to a question like "do we have this in stock". And for such a migration that's not too important if we have the logic in database, or in some other layer. Of course it is always simpler to migrate a database treated like a CSV file, where all the logic (including constraints) is in an external application. But do we really want that?On 4 May 2016 at 18:14, Will McCormick <wmccormick@gmail.com> wrote:I agree it's typically political but so are most things business. Examples: Companies buy other companies - You are using a competitors data store and want to replace it. Company needs to compete with competitors and wants to reduce cost ... these are not technical requirements and it's certainly not vapor ideology. I have only worked for startups and have seen this happen at every company i have worked for, yes it is political but yes it happens. Smaller companies are more susceptible to it.
The reality is somewhere in the middle as it often is. My point is you don't have to replace a million lines of code if you plan upfront. If you don't .. you do.On Wed, May 4, 2016 at 11:29 AM, Uwe Schroeder <uwe@oss4u.com> wrote:On Wed, May 04, 2016 11:05:25 AM Will McCormick wrote:
A reason to consider may be portability. What happens if I want to let my customer chose their data store or I just don't want to put all my eggs in one basket.Technically there are truths but you cannot ignore the business side either. If a we can exceed our performance requirements and keep things generic/portable this is the best of both worlds.I think this is the main reason people separate the business logic from the database. How many of you have ported databases between platforms? Or had multiple types of data stores in the same company?
I have been waiting for the portability argument for the last 20+ posts :-) Everyone who did any type of consulting/working in this field knows that latest the second argument from management is “portability”. I have yet to see anyone who really needed to move to a different database. If they did it usually is a political issue and not a technical one (uhh, we hired this new operations manager and MS SQL is so much better than postgresql …) Unless you develop a generic software to be sold to many clients, the choice of data storage is rarely a real concern unless someone who feels the urge to be important starts throwing words he read in a magazine at management. None of my clients ever questioned the database. They either had one which they wanted to use (i.e. they had a big iron IBM with DB2 on it plus a DBA who knew what he was doing) or they didn't care as long as it worked as expected and came with a maintenance contract of sorts.
If you're developing a web application, the least concern is portability (you're not going to replace the million lines of PHP either). The biggest concern should lie with data integrity and API's that protect your data and business logic so you can hire that cheap app development company from overseas your boss recommended (based on a spam email) without running the risk of compromising everything.
Uwe
On the other hand, when I was trying to store all my logic in a database, there was just one thing that made me hate it. Testing. Testing the procedures inside the database was not easy, not funny, and too much time consuming.--regards Szymon LipińskiIt seems like there is no problem with storing logic anywhere, the problem is with having someone who knows how to write it.--regards Szymon Lipiński--regards Szymon Lipiński
On Tue, May 03, 2016 at 11:11:06PM -0500, Guyren Howe wrote: > I've long been frustrated with how most web developers I meet have no idea how to use an SQL database properly. I thinkI'm going to write a book called Love Your Database, aimed at web developers, that explains how to make their apps betterby leveraging the power of SQL in general, and Postgres in particular. > For whatever it's worth, more than 10 years ago I reviewed (for a publisher) a book along these lines. To my knowledge, it never got published, though I thought it was quite good. The problem is that most development on the web does not, as far as I can tell, regard the development as what I'd think of as a real database-backed system. An awful lot of web systems, in particular, treat the database as a fancy and expensive but somewhat portable filesystem. (This is even more true now that SQL isn't as ubiquitous as it once was.) I still think this is worth promoting, but it seems to me that attempting to create some sort of buzz around these ideas at various developer community events. But there are three things that I think would help make this work for more developers: 1. This will make your application faster. (This needs to be proved -- I agree with the "benchmarks" point in the original post.) 2. This will make your time to ship/continuous integration/time to fix bugs shorter. This is harder to prove, but it's an important value for most developers (and developer managers). 3. This is way cooler than $x. (3) is a distant 3d, but my experience of managing less-experienced developers who go to conferences suggest that it's a good way to get people interested. I think there's something that we're going to have to accept, however, and that's that there are way more application coders than there are people who really get database systems. Fixing this problem requires years of efforts. Best regards, A -- Andrew Sullivan ajs@crankycanuck.ca
On May 4, 2016 4:56:23 PM EDT, Andrew Sullivan <ajs@crankycanuck.ca> wrote: >I think there's something that we're going to have to accept, however, >and that's that there are way more application coders than there are >people who really get database systems. Fixing this problem requires >years of efforts. I don't really get database systems. I remember this conversation with my professor who said we should use ASCII and notUnicode because we won't need anything beyond the ASCII characters (this was on an Oracle database). As an applicationdeveloper, I don't know how I'd keep up with the right way to do things(TM) as rdbms keep evolving. :(
On Tue, 3 May 2016 23:11:06 -0500 Guyren Howe <guyren@gmail.com> wrote: > Any other thoughts? I like this quote from Fred Brooks : `Show me your code and conceal your data structures, and I shall continue to be mystified. Show me your data structures,and I won't usually need your code; it'll be obvious.' It seems to be confirmed by some rather qualified people : http://lwn.net/Articles/193245/ I write management applications for businesses, and give _a lot_ of care to the database structure. I find that the numberof lines of code that need to be written is strictly inversely correlated to the appropriateness of the database design(meaning that the better the database structure, the lesser code is needed). Knowing about the many fine functions Postgresql offers also helps, of course. -- Bien à vous, Vincent Veyron https://libremen.com Logiciels de gestion, libres
> From: Pierre Chevalier Géologue [mailto:pierrechevaliergeol@free.fr] > ... > > Then I think you've seriously misunderstood. Most people can indeed > >learn to write basic SQL queries, but those are > >(obviously) not what I'm talking about. > > > > To write the business logic of a significant application entirely in > >SQL requires PLSQL (or in other dialects, whatever passes for SQL/PSM). > >It means writing an entire data access layer as a set of stored > >procedures, with a substantial set of special functions, types, > >triggers and so on. No beginner and few experts have the skills > >required to do that in SQL, and then debug that code on the server. > > All right, I understand better now. I think I also totally missed your > point, sorry... > I'll give a look at andl. I hope you do. Please feel free to contact me with any comments, suggestions, etc. I have not completed the Postgres implementation -- probably another couple of weeks -- but in-memory and Sqlite are there. Bonne chance! Regards David M Bennett FACS Andl - A New Database Language - andl.org
>From: Vincent Veyron Sent: Wednesday, May 04, 2016 3:35 PM >I write management applications for businesses, and give _a lot_ of care to the database structure. >I find that the number of lines of code that need to be written is strictly inversely correlated to the >appropriateness of the database design (meaning that the better the database structure, the lesser >code is needed). >Knowing about the many fine functions Postgresql offers also helps, of course. > Bien à vous, Vincent Veyron An inverse corollary is also true, imo: encountering demands for exotic, wild functions, cursors and code constructs (like triggers calling triggers or frankly, triggers in general), is nearly always an indication of poor database design. I'm not talking about windowing functions or json or CTEs, btw. Postgres and mysql have piles and piles of functions that I will never use and can't even imagine scenarios in which to use them. So I agree 100% - it's all about the database (design). BTW, I'm currently designing/building OLTP databases for use in genomics research (using Postgres)...that's big data...where there is zero tolerance for slack db design that could cause scalability or performance issues. My stored functions are...relatively simple. Mike Sofen (San Diego, CA USA)
From: dandl Sent: Wednesday, May 04, 2016 5:05 PM
To: 'Pierre Chevalier Géologue' <pierrechevaliergeol@free.fr>
> From: Pierre Chevalier Géologue [mailto:pierrechevaliergeol@free.fr]
> ...
> > Then I think you've seriously misunderstood. Most people can indeed
> >learn to write basic SQL queries, but those are
> >(obviously) not what I'm talking about.
> >
> > To write the business logic of a significant application entirely in
> >SQL requires PLSQL (or in other dialects, whatever passes for SQL/PSM).
> >It means writing an entire data access layer as a set of stored
> >procedures, with a substantial set of special functions, types,
> >triggers and so on. No beginner and few experts have the skills
> >required to do that in SQL, and then debug that code on the server.
>
> All right, I understand better now. I think I also totally missed
> your point, sorry...
> I'll give a look at andl.
I hope you do. Please feel free to contact me with any comments, suggestions, etc.
I have not completed the Postgres implementation -- probably another couple of weeks –
but in-memory and Sqlite are there.
Bonne chance!
Regards
David M Bennett FACS
=======================
I disagree. I’ve worked as database architect/engineer at a number of large and small firms in various verticals (healthcare, financials, insurance, aerospace, telecom, etc), and created complete database api’s via stored procs/stored functions, some of which were quite complex. I’ve found that a mid-level database developer, with modest coaching and good comments in the code, can pick up the code, support it and even enhance it. So the notion that experts can only write and maintain quality code isn’t valid in my experience.
There is definitely a difference in capability/velocity/solution solving between junior, mid-level and senior developers, but that isn’t a deal killer, it’s just something that needs to be managed and accounted for.
One reason for a database api is that ORMs have proved themselves incapable of proper scaling and ACID compliance, where stored procs/functions are capable of leveraging the massive set-based relational power of the underlying engine, and leverage efficient functionalities like windowing functions.
So I guess you’d say I’m in the entirely opposite camp, since it’s proven to be such an effective solution architecture for many applications that leverage relational database engines.
Mike Sofen (San Diego, CA USA)
From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Mike Sofen
I disagree. I’ve worked as database architect/engineer at a number of large and small firms in various verticals (healthcare, financials, insurance, aerospace, telecom, etc), and created complete database api’s via stored procs/stored functions, some of which were quite complex. I’ve found that a mid-level database developer, with modest coaching and good comments in the code, can pick up the code, support it and even enhance it. So the notion that experts can only write and maintain quality code isn’t valid in my experience.
The original proposition was that this (a stored procedure API) was such a simple task any beginner could do it with ease. My view is that it is a job for a seasoned application developer with SQL skills that go well beyond simple queries. I don’t see much disagreement here.
There is definitely a difference in capability/velocity/solution solving between junior, mid-level and senior developers, but that isn’t a deal killer, it’s just something that needs to be managed and accounted for.
One reason for a database api is that ORMs have proved themselves incapable of proper scaling and ACID compliance, where stored procs/functions are capable of leveraging the massive set-based relational power of the underlying engine, and leverage efficient functionalities like windowing functions.
I agree absolutely. ORMs exists because of a strong desire to do business logic coding in the big 5 OO languages and not in whatever dialect of SQL may or may not be available on the RDBMS in question. The whole point of Andl is to make set-based relational logic including user-written accumulation functions, recursion (CTE) and ordered queries (windowing) available and accessible to ordinary developers, and totally avoid the need for an ORM.
So I guess you’d say I’m in the entirely opposite camp, since it’s proven to be such an effective solution architecture for many applications that leverage relational database engines.
It is indeed a totally effective architecture. If you haven’t already read it I strongly recommend http://thehelsinkideclaration.blogspot.com.au/2009/03/window-on-data-applications.html fora detailed description. It’s effective, but it sure ain’t easy, especially if you value portability between RDBMS. Andl aims to fill that gap: make that architecture accessible to all.
I don’t think we’re in different camps at all.
On Tue, 3 May 2016 23:11:06 -0500, Guyren Howe <guyren@gmail.com> wrote: >I've long been frustrated with how most web developers I meet >have no idea how to use an SQL database properly. I think I'm >going to write a book called Love Your Database, aimed at web >developers, that explains how to make their apps better by >leveraging the power of SQL in general, and Postgres in particular. > >I'm thinking of a section on features of SQL most folks don't know >about (CTEs are *way* to hell at the top of that list, but also >EXCEPT/INTERSECT and window functions), but much of the book >would be about how to do things server side. Benchmarks showing >how much faster this can be, but mostly techniques stored >procedures/triggers/rules, views. > >I asked a colleague about the advice I often hear stated but seldom >justified, that one shouldn't put business rules in the database. He >offered that server-side code can be hard to debug. > >I'm sure many here would love to see such a book published, >maybe some talks on the topic given. I think such a book would be wonderful. Unfortunately, I doubt many web coders would take the time to read it. You might want a chapter or 3 on Model-View-Controller ... where it is appropriate and where it isn't. I've seen some truly spectacular backflips done by code trying to shoehorn uncooperative data models into MVC. >What might I cover that I haven't mentioned? What are the usual >objections to server-side code and how can they be met? When >*are* they justified and what should the criteria be to put code in >Postgres? Any other thoughts? Any other websites or books on >the topic I might consult? FWIW: I have a master degree in data modeling. I design databases, and when necessary write web facing middleware for them. The usual objection to stored code is highly conditional queries. For example, my most recent web project has a search which is ~100 lines of SQL with 7 CTEs, 5 of which are executed conditionally depending on user input. This kind of dynamic code is painful to write in most SQL dialects. I compose such queries in middleware preferentially because I can use languages better suited to complex string manipulation. And yes, I am aware of injection: SQL may be composed dynamically, but user input is /never/ spliced - it always is passed via SQL parameters. I am aware that Postgresql has other languages available as extensions. Some of them would do the job - though I think not as nicely as my goto language: Racket (a Scheme dialect). [Yes, I know Guile (Scheme) is one of the extension languages.] The code wouldn't be any less complicated for being resident in the DBMS, and I doubt it would be much faster: my middleware is always either co-located with the DBMS, or on the same LAN if working with a cluster. I draw the line at giving web clients direct access to a database - any web facing system I design always involves mediation via middleware. IME it is the copying/conversion of data to/from the HTTP interface that ultimately limits performance, so where to put the database code largely is a judgement call. YMMV, George
On May 4, 2016 4:56:23 PM EDT, Andrew Sullivan <ajs@crankycanuck.ca> wrote:
>I think there's something that we're going to have to accept, however,
>and that's that there are way more application coders than there are
>people who really get database systems. Fixing this problem requires
>years of efforts.
I don't really get database systems. I remember this conversation with my professor who said we should use ASCII and not Unicode because we won't need anything beyond the ASCII characters (this was on an Oracle database). As an application developer, I don't know how I'd keep up with the right way to do things(TM) as rdbms keep evolving.
:(
On Thu, May 5, 2016 at 12:34 AM, Vincent Veyron <vv.lists@wanadoo.fr> wrote: > I like this quote from Fred Brooks : > > `Show me your code and conceal your data structures, and I shall continue to be mystified. Show me your data structures,and I won't usually need your code; it'll be obvious.' I remembered it as 'Show me your tables,...", which looks even more applicable in this list. A quick googgle search for SMYT did in fact return a link to wikiquote at the top, it says "Show me your flowcharts and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won’t usually need your flowcharts; they’ll be obvious. " from TMMM, so its normal I remember it that way ( I still own it and reread some chunks every couple of years. ) Francisco Olarte.
at my previous jobs I was working with many programmers, and almost none of them understood SQL. The problem was even deeper. They didn't want to learn it. When I was working among java programmers, I noticed that they hated SQL, but there was no problem with learning HQL, which in fact is quite similar. I really have no idea why it is like that.
Similar here. IMHO it is called "job trends hype". Look at all the linkedin ads, less than 1% is about Pgsql/DBs, 99% is about app coders. Ok rough numbers, but it reflects reality. One of my past programmers (a fine kid always looking to learn) now writes IOS and Android apps in another country. Another one who didn't do much well with SQL, but rock-star programmer otherwise, now writes javascript in another company.
--regards Szymon Lipiński
-- Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt
>What might I cover that I haven't mentioned? >What are the usual objections to server-side code and how can they be met? >When *are* they justified and what should the criteria be to put code in Postgres? Any other thoughts? Hi, For my point of view, scalability considerations and possible performance gains are the key arguments to decide where toput things. If a project may end up with tens of application servers connected to a single database, then you should let most of thework on the application side. But to discharge the database, you also have to keep transactions as short as possible. So if some logic process requiresmany back and forth within a single transaction, then it may make sense to implement it on the DB side; most developpersI'm working with are resistent to this aspect. ORM layers are usefull, but nasty as they transform the database into a blackbox. I guess this can be a major reason whydevelopers don't care for the SQL side. Testing should include some monitoring of the DB activity, which often happensway too late. I try since years to convince my colleagues, that application code doesn't matter ;-) What counts are the data and how theyare arranged within the DB. Therefore they should put more focus on them, rather then think in OOM. That book is a great idea. A collection of bad code example and the SQL equivalents, strengthend with runtimes figures, mayhelp move some minds best regards, Marc Mamin
Hello, (sorry for delay, I've been traveling) Le 04/05/2016 17:08, John McKown a écrit : >>>> ... >>>> Allowing PHBs direct access to company data is a nasty thing. >>> >>> Sorry, what is a PHB? Our friend google didn't help me much on this >>> matter. > >> Ah. Sorry. PHB is a "Pointy Haired Boss" and is a reference to the >> comic "Dilbert". Dilbert is a engineer who works for a boss who is a >> complete idiot & has his hair moussed up at the sides (I guess it is >> moussed). Le 04/05/2016 17:05, Steve Crawford a écrit : > Perhaps a bit US centric but PHB = Pointy Haired Boss. See the boss in > "Dilbert". Alright, got it, thanks. I admire Dilbert; I've had bosses like PHB... >> ... >> Hm. Sounds familiar... >> I usually call "excelitis" a sort of mental disease related to a use >> and abuse of Excel, up to the point where one cannot imagine data >> which is *not* in a table-like array. And they think that they do >> Relational Database Management... In the 1990's, I met many-many >> deeply sick persons. I had been infected for a while, I must confess. > > Yes, I keep reading in another forum about how to interface the R > language so that the users can continue to input data into Excel, but > then have it run a R language script to produce some output. So many > there are trying to use Excel as their "user interface" because it is > just about all the user knows. Well, that could be a good way to pull them out of excel: once they will realize that there is no way that they can do what R does with macros and formulas (yes, they will try hard to get rid of R, I'm sure...), it may open up their mind and consider other ways of looking at data than mere two-dimensional tables... > I had a manager, long ago, who used a Lotus 1-2-3 spreadsheet to contain > all his memos. I was glassy eyed in disbelief. Well... I did use 1-2-3 as a sort-of database (I was young... bad excuse). And also, I had used Excel to produce final reports, with plenty of graphics, I used the vector editing tools a lot to make fancy figures... Hm. Long time ago. > He also would use his hand calculator to add up the numbers > in the spreadsheet to be sure that the summation function in the > spreadsheet didn't make a mistake. <shudder/> Uh-oh. This is worrying. But it makes me think of a famous excel bug, where you had something like 1 - 1 = 2... Maybe your boss was actually very wise (and paranoid)?... À+ Pierre -- ____________________________________________________________________________ Pierre Chevalier PChGEI: Pierre Chevalier Géologue Et Informaticien Partenaire DALIBO Mesté Duran 32100 Condom Tél+fax : 09 75 27 45 62 06 37 80 33 64 Émail : pierrechevaliergeolCHEZfree.fr icq# : 10432285 jabber: pierre.chevalier1967@jabber.fr http://pierremariechevalier.free.fr/pierre_chevalier_geologue ____________________________________________________________________________
Hi, Le 04/05/2016 17:55, Alban Hertroys a écrit : > On 4 May 2016 at 17:08, John McKown <john.archie.mckown@gmail.com> wrote: >> I had a manager, long ago, who used a Lotus 1-2-3 spreadsheet to >> contain all his memos. I was glassy eyed in disbelief. He also would use his >> hand calculator to add up the numbers in the spreadsheet to be sure that the >> summation function in the spreadsheet didn't make a mistake. <shudder/> > > That still happens - we have a few live examples around in this > company. Unfortunately they're not caged and there's no sign "Do not > feed the managers". Admittedly, they're using Excel instead of > Lotus-1-2-3, but that's the only difference. ;-D Another step (forward obviously) for these fellows is to use MSAccess. Much better, yes. But, still... On this matter, I hear *very* often from such guys that the only reproach they have to PostgreSQL is that it does not come with a slick GUI like Access. PGAdmin does not suit their needs at all: they want to design their forms, directly write into the tables by using quick'n easy/dirty copy/paste from/to their Excel (yes, it is still lying around). I understand them, somehow. There are a few tools around, many proprietary ones, some Free/Libre ones, but they are still looking for a sort of Holy Grail that would definitely convince them. A standard client tool that would come with any PostgreSQL installation would please them. Some sort of psqlGUI, I guess. Something to think about... Maybe it would more suitable into "advocacy" than here in "general", though. À+ Pierre -- ____________________________________________________________________________ Pierre Chevalier PChGEI: Pierre Chevalier Géologue Et Informaticien Partenaire DALIBO Mesté Duran 32100 Condom Tél+fax : 09 75 27 45 62 06 37 80 33 64 Émail : pierrechevaliergeolCHEZfree.fr icq# : 10432285 jabber: pierre.chevalier1967@jabber.fr http://pierremariechevalier.free.fr/pierre_chevalier_geologue ____________________________________________________________________________
On this matter, I hear *very* often from such guys that the only reproach they have to PostgreSQL is that it does not come with a slick GUI like Access.
Access is a lot more than a slick GUI, its a rapid application development system based on VisualBasic.
-- john r pierce, recycling bits in santa cruz
On 17 May 2016 at 09:34, Pierre Chevalier Géologue <pierrechevaliergeol@free.fr> wrote: > On this matter, I hear *very* often from such guys that the only reproach > they have to PostgreSQL is that it does not come with a slick GUI like > Access. PGAdmin does not suit their needs at all: they want to design their > forms, directly write into the tables by using quick'n easy/dirty copy/paste > from/to their Excel (yes, it is still lying around). I understand them, > somehow. > There are a few tools around, many proprietary ones, some Free/Libre ones, > but they are still looking for a sort of Holy Grail that would definitely > convince them. A standard client tool that would come with any PostgreSQL > installation would please them. Some sort of psqlGUI, I guess. Why reinvent the wheel? I would say that putting the development effort into the OpenOffice Base app would be time better spent. Geoff
On 17/05/2016 12:16, Geoff Winkless wrote: > On 17 May 2016 at 09:34, Pierre Chevalier Géologue > <pierrechevaliergeol@free.fr> wrote: >> On this matter, I hear *very* often from such guys that the only reproach >> they have to PostgreSQL is that it does not come with a slick GUI like >> Access. PGAdmin does not suit their needs at all: they want to design their >> forms, directly write into the tables by using quick'n easy/dirty copy/paste >> from/to their Excel (yes, it is still lying around). I understand them, >> somehow. >> There are a few tools around, many proprietary ones, some Free/Libre ones, >> but they are still looking for a sort of Holy Grail that would definitely >> convince them. A standard client tool that would come with any PostgreSQL >> installation would please them. Some sort of psqlGUI, I guess. > Why reinvent the wheel? I would say that putting the development > effort into the OpenOffice Base app would be time better spent. Sorry if I missed something but what's wrong with pgadmin3 ? > Geoff > > -- Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt
On 17 May 2016 at 10:22, Achilleas Mantzios <achill@matrix.gatewaynet.com> wrote: > On 17/05/2016 12:16, Geoff Winkless wrote: >> >> On 17 May 2016 at 09:34, Pierre Chevalier Géologue >> <pierrechevaliergeol@free.fr> wrote: >>> >>> On this matter, I hear *very* often from such guys that the only reproach >>> they have to PostgreSQL is that it does not come with a slick GUI like >>> Access. PGAdmin does not suit their needs at all: they want to design >>> their >>> forms, directly write into the tables by using quick'n easy/dirty >>> copy/paste >>> from/to their Excel (yes, it is still lying around). I understand them, >>> somehow. >>> There are a few tools around, many proprietary ones, some Free/Libre >>> ones, >>> but they are still looking for a sort of Holy Grail that would definitely >>> convince them. A standard client tool that would come with any >>> PostgreSQL >>> installation would please them. Some sort of psqlGUI, I guess. >> >> Why reinvent the wheel? I would say that putting the development >> effort into the OpenOffice Base app would be time better spent. > > Sorry if I missed something but what's wrong with pgadmin3 ? There's nothing wrong with pgadmin as such. From the very email you just quoted: >>> they want to design their forms ie (as I understand it) they're after some sort of RAD tool. Geoff
On May 17, 2016, at 2:22 , Achilleas Mantzios <achill@matrix.gatewaynet.com> wrote: > > Sorry if I missed something but what's wrong with pgadmin3 ? Apart from it's awful, clunky, bug-ridden and crash prone, nothing.
On 17/05/2016 18:38, Guyren Howe wrote: > On May 17, 2016, at 2:22 , Achilleas Mantzios <achill@matrix.gatewaynet.com> wrote: >> >> Sorry if I missed something but what's wrong with pgadmin3 ? > > Apart from it's awful, clunky, bug-ridden and crash prone, nothing. In fairness to pgAdmin 3: - It's not a development platform, such as MS Access tries to be; it's an admin tool, pure and simple. - pgAdmin 4 is in heavy development, and not too far from a beta; pgAdmin 3 has only been receiving bug fixes for quite some time now. - A lot of the problems in pgAdmin 3 are due to upstream bugs in wxWidgets, over which the pgAdmin team has no control (hence pgAdmin 4). Having said all that, I've rarely had any trouble with pgAdmin 3 on Windows 7 and XP, Ubuntu and Debian; just a very occasional crash (maybe one every six months). Ray. -- Raymond O'Donnell :: Galway :: Ireland rod@iol.ie
On 17/05/2016 20:38, Guyren Howe wrote: > On May 17, 2016, at 2:22 , Achilleas Mantzios <achill@matrix.gatewaynet.com> wrote: >> Sorry if I missed something but what's wrong with pgadmin3 ? > Apart from it's awful, clunky, bug-ridden and crash prone, nothing. > There is a solution for that : either find the bugs and submit patches or pay the developers to fix the bugs or make youa custom version or go buy some other tool, or write your own or live with psql (like most people do). In the occasions (once/twice a week) that I needed pgadmin during my last 16 years with postgresql, it delivered just fine. Some guys here use some better tools to access pgsql but they all cost money. I have paid for RazorSQL for accessing ourMS SQL server, then felt lucky I was accessing pgsql via psql (or even pgqdmin3) all those years. -- Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt
> Windows 7 and XP, Ubuntu and Debian; just a very occasional crash (maybe
> one every six months).
> On Tue, May 17, 2016 at 1:54 PM, Raymond O'Donnell <rod@iol.ie> wrote:> Having said all that, I've rarely had any trouble with pgAdmin 3 on
> Windows 7 and XP, Ubuntu and Debian; just a very occasional crash (maybe
> one every six months).So just to chime in, it has not been at all that stable for my team and I. It's not bad when connections are all stable or you're connecting to a local instance, but if the connection between you and the server isn't perfect... it's one of the least stable pieces of software I've ever used.I'm sure for those who's servers are hosted locally, and you connect through a lan, or those with a decent provider, it works much better than for me.My team is all remote though, and we don't have an office. Each of my employees connects using their own internet connection, with varying reliability. Servers hosted on a cloud provider. Crashes happen multiple times a day for most.
Hi, Le 17/05/2016 10:44, John R Pierce a écrit : > On 5/17/2016 1:34 AM, Pierre Chevalier Géologue wrote: >> >> On this matter, I hear *very* often from such guys that the only >> reproach they have to PostgreSQL is that it does not come with a slick >> GUI like Access. > > Access is a lot more than a slick GUI, Yes; some claim that it is even a database. I was just trying to mean that the GUI part of Access (to design forms, work with data almost like in a spreadsheet) was what these fellows were missing. > its a rapid application development system based on VisualBasic. Well, I wouldn't say exactly so. VB was incorporated a while after the release of VB... 2, was it? I can't remember well. Sure, you can put VB code in your Access .mdb (or .mda), but you can certainly design a whole GUI for your database without the need of any VB line of code. À+ Pierre -- ____________________________________________________________________________ Pierre Chevalier PChGEI: Pierre Chevalier Géologue Et Informaticien Partenaire DALIBO Mesté Duran 32100 Condom Tél+fax : 09 75 27 45 62 06 37 80 33 64 Émail : pierrechevaliergeolCHEZfree.fr icq# : 10432285 jabber: pierre.chevalier1967@jabber.fr http://pierremariechevalier.free.fr/pierre_chevalier_geologue ____________________________________________________________________________
Le 17/05/2016 11:25, Geoff Winkless a écrit : >>>> but they are still looking for a sort of Holy Grail that would definitely >>>> convince them. A standard client tool that would come with any >>>> PostgreSQL >>>> installation would please them. Some sort of psqlGUI, I guess. >>> >>> Why reinvent the wheel? I would say that putting the development >>> effort into the OpenOffice Base app would be time better spent. True. But I must say that I would be looking towards something a bit lighter. LibreOffice is a bit of a heavyweight, IMHO. The "Base" is kind of bizarre to use, I always miss some of its logic, somehow. I have to try its latest version, see if it's decently usable for a lambda user. >> Sorry if I missed something but what's wrong with pgadmin3 ? > There's nothing wrong with pgadmin as such. Yes, nothing wrong at all. It is not meant to make UI. Just some basic features are implemented for table data editing. > From the very email you just quoted: >>>> they want to design their forms > ie (as I understand it) they're after some sort of RAD tool. Yes, that's it, in a way. Although designing forms is not what I would call AD (application development)... When you look back at dBase III or IV, the text user interface which allowed to interact with the data was very simple, and efficient. Designing forms (I didn't do much of these, and I can't remember well) was quite straightforward, and was not at all what I would call an "application development". The latter would be made by using clipper, most often. À+ Pierre -- ____________________________________________________________________________ Pierre Chevalier PChGEI: Pierre Chevalier Géologue Et Informaticien Partenaire DALIBO Mesté Duran 32100 Condom Tél+fax : 09 75 27 45 62 06 37 80 33 64 Émail : pierrechevaliergeolCHEZfree.fr icq# : 10432285 jabber: pierre.chevalier1967@jabber.fr http://pierremariechevalier.free.fr/pierre_chevalier_geologue ____________________________________________________________________________
Interesting point of view. Time to make a bug report, isn't it? ;-) À+ Pierre Le 18/05/2016 17:44, Adam Brusselback a écrit : >> On Tue, May 17, 2016 at 1:54 PM, Raymond O'Donnell<rod@iol.ie <mailto:rod@iol.ie>> wrote: > >> Having said all that, I've rarely had any trouble with pgAdmin 3 on > >> Windows 7 and XP, Ubuntu and Debian; just a very occasional crash (maybe > >> one every six months). > > So just to chime in, it has not been at all that stable for my team and > I. It's not bad when connections are all stable or you're connecting to > a local instance, but if the connection between you and the server isn't > perfect... it's one of the least stable pieces of software I've ever used. > > I'm sure for those who's servers are hosted locally, and you connect > through a lan, or those with a decent provider, it works much better > than for me. > My team is all remote though, and we don't have an office. Each of my > employees connects using their own internet connection, with varying > reliability. Servers hosted on a cloud provider. Crashes happen > multiple times a day for most. > > Just wanted to share my experience. -- ____________________________________________________________________________ Pierre Chevalier PChGEI: Pierre Chevalier Géologue Et Informaticien Partenaire DALIBO Mesté Duran 32100 Condom Tél+fax : 09 75 27 45 62 06 37 80 33 64 Émail : pierrechevaliergeolCHEZfree.fr icq# : 10432285 jabber: pierre.chevalier1967@jabber.fr http://pierremariechevalier.free.fr/pierre_chevalier_geologue ____________________________________________________________________________
Yes, that's it, in a way. Although designing forms is not what I would call AD (application development)...
When you look back at dBase III or IV, the text user interface which allowed to interact with the data was very simple, and efficient. Designing forms (I didn't do much of these, and I can't remember well) was quite straightforward, and was not at all what I would call an "application development". The latter would be made by using clipper, most often.
MS Access is all about forms, reports, and data, with visualbasic macros for data manipulation.
-- john r pierce, recycling bits in santa cruz
Le 04/05/2016 18:29, Szymon Lipiński a écrit : > On the other hand, when I was trying to store all my logic in a > database, there was just one thing that made me hate it. Testing. > Testing the procedures inside the database was not easy, not funny, and > too much time consuming. Yes, very good point. À+ Pierre -- ____________________________________________________________________________ Pierre Chevalier PChGEI: Pierre Chevalier Géologue Et Informaticien Partenaire DALIBO Mesté Duran 32100 Condom Tél+fax : 09 75 27 45 62 06 37 80 33 64 Émail : pierrechevaliergeolCHEZfree.fr icq# : 10432285 jabber: pierre.chevalier1967@jabber.fr http://pierremariechevalier.free.fr/pierre_chevalier_geologue ____________________________________________________________________________
On May 20, 2016, at 13:38 , Pierre Chevalier Géologue <pierrechevaliergeol@free.fr> wrote: > > Le 04/05/2016 18:29, Szymon Lipiński a écrit : >> On the other hand, when I was trying to store all my logic in a >> database, there was just one thing that made me hate it. Testing. >> Testing the procedures inside the database was not easy, not funny, and >> too much time consuming. > > Yes, very good point. Are there any best practices or tricks to make this easier?
Interesting conversation. While reading it, I sort of regret the times when a single guy was in charge of the whole thing, and managed to simply make it work, using all possible tools he had. "Informaticien" was the generic term, in French. Every single part of the big thing he built (hardware on server and clients' sides, database, network, client programs, server programs, etc.) may not be perfect (often from far), but the whole thing was running smoothly, and he knew perfectly what to fix when something was happening. Yes, it took a multipurpose fellow to do that, neither a "SQL-only" fellow, nor a "C-what-else" guy. It also reminds me of a paper I read once, where it was carefully explained why scientists hated databases. But that's another subject. Le 04/05/2016 21:22, Will McCormick a écrit : > Yeah but your already paying for a developer ... À+ Pierre -- ____________________________________________________________________________ Pierre Chevalier PChGEI: Pierre Chevalier Géologue Et Informaticien Partenaire DALIBO Mesté Duran 32100 Condom Tél+fax : 09 75 27 45 62 06 37 80 33 64 Émail : pierrechevaliergeolCHEZfree.fr icq# : 10432285 jabber: pierre.chevalier1967@jabber.fr http://pierremariechevalier.free.fr/pierre_chevalier_geologue ____________________________________________________________________________
> On May 20, 2016, at 1:43 PM, Guyren Howe <guyren@gmail.com> wrote: > > On May 20, 2016, at 13:38 , Pierre Chevalier Géologue <pierrechevaliergeol@free.fr> wrote: >> >> Le 04/05/2016 18:29, Szymon Lipiński a écrit : >>> On the other hand, when I was trying to store all my logic in a >>> database, there was just one thing that made me hate it. Testing. >>> Testing the procedures inside the database was not easy, not funny, and >>> too much time consuming. >> >> Yes, very good point. > > Are there any best practices or tricks to make this easier? In-database unit tests help. pgTap is a decent framework for building that sort of test-suite in a way that'll play nice with reporting and CI tools. http://pgtap.org Cheers, Steve
In-database unit tests help. pgTap is a decent framework
> On May 20, 2016, at 1:43 PM, Guyren Howe <guyren@gmail.com> wrote:
>
> On May 20, 2016, at 13:38 , Pierre Chevalier Géologue <pierrechevaliergeol@free.fr> wrote:
>>
>> Le 04/05/2016 18:29, Szymon Lipiński a écrit :
>>> On the other hand, when I was trying to store all my logic in a
>>> database, there was just one thing that made me hate it. Testing.
>>> Testing the procedures inside the database was not easy, not funny, and
>>> too much time consuming.
>>
>> Yes, very good point.
>
> Are there any best practices or tricks to make this easier?
for building that sort of test-suite in a way that'll play nice with
reporting and CI tools.
http://pgtap.org
Cheers,
Steve
On May 20, 2016, at 13:38 , Pierre Chevalier Géologue <pierrechevaliergeol@free.fr> wrote:
>
> Le 04/05/2016 18:29, Szymon Lipiński a écrit :
>> On the other hand, when I was trying to store all my logic in a
>> database, there was just one thing that made me hate it. Testing.
>> Testing the procedures inside the database was not easy, not funny, and
>> too much time consuming.
>
> Yes, very good point.
Are there any best practices or tricks to make this easier?
I only write tests outside the database. Currently I'm involved in projects where all the logic is outside, so having tests outside is rather obvious. However I have a small toy project with logic inside the database, and tests outside. I also think that it doesn't matter where the tests are, it is important to have them, and run them. I'm not sure that tests inside are much better solution.
On May 20, 2016, at 13:38 , Pierre Chevalier Géologue <pierrechevaliergeol@free.fr> wrote:
>
> Le 04/05/2016 18:29, Szymon Lipiński a écrit :
>> On the other hand, when I was trying to store all my logic in a
>> database, there was just one thing that made me hate it. Testing.
>> Testing the procedures inside the database was not easy, not funny, and
>> too much time consuming.
>
> Yes, very good point.
Are there any best practices or tricks to make this easier?
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
--
On Fri, May 20, 2016 at 10:43 PM, Guyren Howe <guyren@gmail.com> wrote:On May 20, 2016, at 13:38 , Pierre Chevalier Géologue <pierrechevaliergeol@free.fr> wrote:
>
> Le 04/05/2016 18:29, Szymon Lipiński a écrit :
>> On the other hand, when I was trying to store all my logic in a
>> database, there was just one thing that made me hate it. Testing.
>> Testing the procedures inside the database was not easy, not funny, and
>> too much time consuming.
>
> Yes, very good point.
Are there any best practices or tricks to make this easier?Strangely I have never had a problem testing stored procedures. You have to create a data set for the tests of course and that is the hardest part, but there are some really nice things:1. If your test scripts always roll back you can run them on a production database as a troubleshooting step2. It is easy to hook things up to a TAP harness (whether using PgTAP or some hand-rolled solution). I think it would be harder to connect to xunit though. So use TAP ;-)3. I usually create a test results table (in my test case, rolled back after!) which stores the test description and pass status. That makes it easy to check using other tools.Usually I set aside a range of things (negative id's for example) for testing purposes.
Strangely I have never had a problem testing stored procedures. You have to create a data set for the tests of course and that is the hardest part, but there are some really nice things:1. If your test scripts always roll back you can run them on a production database as a troubleshooting step2. It is easy to hook things up to a TAP harness (whether using PgTAP or some hand-rolled solution). I think it would be harder to connect to xunit though. So use TAP ;-)3. I usually create a test results table (in my test case, rolled back after!) which stores the test description and pass status. That makes it easy to check using other tools.Usually I set aside a range of things (negative id's for example) for testing purposes.I had problems, and I'm really interested in making it work for me. I have a couple of questions:How do you manage versioning of the stored procedures? Especially do you have any problems upgrades?
What about testing logic which is outside the database? Do you use pgtap for testing the schema only, or to test some of the external logic as well?
Do you use logic inside and outside the database at the same time?
How does this scale to a couple of servers when the load is so huge you need to have e.g. ten physical web servers at front?
It seems for me that it would be easier to spread the cpu logic overhead to plenty of servers instead of having just one machine which needs to do all the things. But maybe I'm wrong.
--regards Szymon Lipiński
--