1

Topic: Business of the logician in

Colleagues whether So badly to implement business the logic in high-efficiency stored procedures? Or now it is fashionable to use  type  which generate awful sql requests? Considering that the SQL text as a rule more  also is better read.

2

Re: Business of the logician in

Hello, Gattaka, you wrote: G> Colleagues, whether G> So badly to implement business the logic in high-efficiency stored procedures? Or now it is fashionable to use  type  which generate awful sql requests? Considering that the SQL text as a rule more  also is better read. About feng shui we will not be, it and without me tell. From the practical point of view - well it is possible, yes. In the presence of certain conditions, certainly. 1. The project long-living, is meaningly fastened on defined  and does not plan to migrate in a cloud "somehow then". If here explanations are necessary - I will add. 2. Scripts are stored together with other source codes (the separate project, certainly) and checked by the same principles - tests, the bild-server, scripts of migration with mandatory check  on the previous let out versions both  and . 3. In scripts that there really it makes sense to carry out lies only. Stupidly to overtake all  on the DBMS side was ineffectively in all senses that on support that on productivity. Well and what exactly to pack in scripts - native sql,  or view -  already to the discretion of developers.

3

Re: Business of the logician in

Hello, Sinix, you wrote: S> About feng shui we will not be, it and without me tell. From the practical point of view - well it is possible, yes. In the presence of certain conditions, certainly. I about  would express "well it is possible, yes..." When you checked up generated request that  and this version  it more is less normally generated by this. And if not so it is critical  from basis of superfluous data volume to fill fields of essence which are not used. And as a whole from  much more problems, than advantage.

4

Re: Business of the logician in

G> I about  would express "well it is possible, yes..." When you checked up generated request that  and this version  it more is less normally generated by this. And if not so it is critical  from basis of superfluous data volume to fill fields of essence which are not used. Who hinders to pull out only that data which needs and be not to dragged the superfluous? G> and as a whole from  much more problems, than advantage. Can you be not able be simple it to prepare?

5

Re: Business of the logician in

Whether G> So badly to implement business the logic in high-efficiency stored procedures? The question is initially delivered so that you already for itself  that is better. Came to find support of the decision? G> or now it is fashionable to use  type  which generate awful sql requests? Awful SQL they generate the code when the person who writes request with usage ORM, does not understand that it does. But the same result will be if the same person starts to write sql request. G> considering that the SQL text as a rule more  also is better read. Just concerns samplings of the relational data. In remaining we receive an array of problems. - to implement the difficult logic in times the code is more difficult also becomes terrible - complexities with code reusage. Or gives on performance, or  - bad

6

Re: Business of the logician in

Hello, HeBpuMHeCkaTuHa, you wrote: G>> I about  would express "well it is possible, yes..." When you checked up generated request that  and this version  it more is less normally generated by this. And if not so it is critical  from basis of superfluous data volume to fill fields of essence which are not used. HBM> who hinders to pull out only that data which needs and be not to dragged the superfluous?  hinders. At me, we admit  the table on essence, and from this essence it is necessary for steam of columns for the report.  all essence pulls out and further you will work with that field that is necessary for you. G>> And as a whole from  much more problems, than advantage. HBM> can you be not able be simple it to prepare? Here expenses for this cooking too big. You should write request by means of ORM, then look in what it , then rewrite, then see that did not help Instead of at once writing etc. normal SQL request. And just  I noted that among supporters ORM much those who does not know how to cook SQL just

7

Re: Business of the logician in

HBM>> who hinders to pull out only that data which needs and be not to dragged the superfluous? G>  hinders. At me, we admit  the table on essence, and from this essence it is necessary for steam of columns for the report.  all essence pulls out and further you will work with that field that is necessary for you. Who hinders to create one more DTO with that field which are necessary and not to pull all? G>>> and as a whole from  much more problems, than advantage. HBM>> can you be not able be simple it to prepare? G> here expenses for this cooking too big. You should write request by means of ORM, then look in what it , then rewrite, then see that did not help Instead of at once writing etc. normal SQL request. And just  I noted that among supporters ORM much those who does not know how to cook SQL just  well certainly. 100500 CRUD storable it paradise is direct. On everyone  on the storable. On each small essence on 5 storable. Not   to optimize sql it is necessary when there are problems with performance. 90 % of operations of application it  CRUD, and with it any ORM perfectly consult. And further in need of some places it is possible and  to use, if it will be necessary.

8

Re: Business of the logician in

Hello, HeBpuMHeCkaTuHa, you wrote: whether G>> So badly to implement business the logic in high-efficiency stored procedures? HBM> the question is initially delivered so that you already for itself  that is better. Came to find support of the decision? And you noted, observation to you will not refuse... It is motivation was. G>> or now it is fashionable to use  type  which generate awful sql requests? HBM> awful SQL they generate the code when the person who writes request with usage ORM, does not understand that it does. HBM> but the same result will be if the same person starts to write sql request. Well it is substitution of concepts. Let's recognize that the person both sql normally writes and ORM well knows. G>> considering that the SQL text as a rule more  also is better read. HBM> just concerns samplings of the relational data. HBM> in remaining we receive an array of problems. HBM> - to implement the difficult logic in times the code is more difficult also there are terrible Fairy tales about the terrible code. And what such the beautiful code? On me so it is the high-efficiency code. HBM> - complexities with code reusage. Or gives on performance, or  the argument is not clear. HBM> - bad  Excellent , simply test open scenarios and all will be APPRX.

9

Re: Business of the logician in

Hello, HeBpuMHeCkaTuHa, you wrote: HBM> who hinders to create one more DTO with that field which are necessary and not to pull all? DTO? ... Well it is fine, because these DTO yours  it becomes simple - growth logarithmic literally. G>>>> and as a whole from  much more problems, than advantage. HBM>>> can you be not able be simple it to prepare? G>> here expenses for this cooking too big. You should write request by means of ORM, then look in what it , then rewrite, then see that did not help Instead of at once writing etc. normal SQL request. And just  I noted that among supporters ORM much those who does not know how to cook SQL just  HBM> well certainly. 100500 CRUD storable it paradise is direct. HBM> on everyone  on the storable. On each small essence on 5 storable. HBM> not   but here just  it is possible  to apply, as I wrote above. This only thing with what it can . HBM> to optimize sql it is necessary when there are problems with performance. 90 % of operations of application it  CRUD, and with it any ORM perfectly consult. Nonsense. It is necessary to write the optimum code at once. Premature pessimization leads to projects, which and for half a year not . HBM> and further in need of some places it is possible and  to use, if it will be necessary.

10

Re: Business of the logician in

Hello, Gattaka, you wrote: G> I about  would express "well it is possible, yes..." Here /  / project requirements / the DBMS in  depends on language. If language is not able in linq,  (to substitute a jamb to taste), the project allows to waste time on attending of scripts at each refactoring, and the DBMS optimizer chokes on the elementary requests (we will not speak who, but  in this sense still anything), yes - presence / absence ORM smaller of problems. G> and as a whole from  much more problems, than advantage. Well a pancake. ORM not in itself works, it should be used in a stack. I.e. plus local transactions, plus change tracking plus serialization of changes on a network, + handling in one transaction of the data which are declared in different assembly (i.e. the general  as that, is not present) + clever  + automigration / autodevelopment both  and . It as paper drawings vs designing in digit - the main scoring turns out, when all line-up, up to instrumental control is used. Otherwise uncle Vasja with  digit turns out "does not understand - a sediment your digit".

11

Re: Business of the logician in

Hello, HeBpuMHeCkaTuHa, you wrote: HBM> just concerns samplings of the relational data. HBM> in remaining we receive an array of problems. Not absolutely from that side of the problem describe. All it dares, only for absolutely separate money. At first, the developer should __ selected . Not to be able to write select*from, namely the nobility. As a separate programming language. Secondly, sql does not forgive errors because of universal wretchedness of work benches. Refactoring, global check of scripts to change the data scheme without knee-bends? Not, did not hear. I.e. the developer should be also skilled and to be able to think __, how to do (that after cozy studio a little bit so strains). Well and in the third, the developer should though a little bit to be able in architecture and in data domain. The sm the previous point, late floated jamb in design of the circuit can not be repaired by years for its correction costs on pair orders more expensively, than a business hour of a hot line which about this jamb already knows and is able to repair somewhere once a year. Well and where you find now such volunteers in commodity amounts? And, the main thing,  to waste time on  supports instead of more useful things? Therefore it is better to use "bare" sql there where from it balance favor/suffering positive and to dig it far away in all remaining places.

12

Re: Business of the logician in

Whether G>>> So badly to implement business the logic in high-efficiency stored procedures? HBM>> the question is initially delivered so that you already for itself  that is better. Came to find support of the decision? G> and you noted, observation to you will not refuse... It is motivation was. It is argument towards what to conduct on this subject discussion initially it is not meaningful, as you are is solid assured of the correctness and will be just prejudiced HBM>> concerns samplings of the relational data. HBM>> in remaining we receive an array of problems. HBM>> - to implement the difficult logic in times the code is more difficult also there are terrible G> Fairy tales about the terrible code. And what such the beautiful code? On me so it is the high-efficiency code. The beautiful code the concept is finite rather. I put in it more often laconicism. If I can F# solve with the help the task 3 in the lines, and on SQL - 25 lines the choice is obvious to me HBM>> - complexities with code reusage. Or gives on performance, or  G> the argument is not clear. What here not clear?  the available code in SQL it is the extremely difficult. Modularity is not present. HBM>> - bad  G> Excellent , simply test open scenarios and all APPRX. will write integration tests more difficult and more unprofitably.

13

Re: Business of the logician in

HBM>> who hinders to create one more DTO with that field which are necessary and not to pull all? G> DTO? ... Well it is fine, because these DTO yours  it becomes simple - growth logarithmic literally. Them becomes so much, how many it is necessary. Bad anything in it is not present. HBM>> well it is finite. 100500 CRUD storable it paradise is direct. HBM>> on everyone  on the storable. On each small essence on 5 storable. HBM>> not   G> but here just  it is possible  to apply, as I wrote above. This only thing with what it can . Well though on it converged. Already perfectly HBM>> to optimize sql it is necessary when there are problems with performance. 90 % of operations of application it  CRUD, and with it any ORM perfectly consult. G> nonsense. It is necessary to write the optimum code at once. Premature pessimization leads to projects, which and for half a year not . Premature optimization not smaller harm. The code should be normal, but there is no sense to pursue for +1 % of performance. HBM>> and further in need of some places it is possible and  to use, if it will be necessary.

14

Re: Business of the logician in

Hello, HeBpuMHeCkaTuHa, you wrote: HBM> the beautiful code the concept is finite rather. HBM> I put in it more often laconicism. HBM> if I can F# solve with the help the task 3 in the lines, and on SQL - 25 lines the choice is obvious to me Here only on F# at you not 3 lines turns out both not 30 and not 300 to receive analog. When you start to tell about escalation of locks, about isolation levels transaction, about that that the DBMS can select automatically nested loop or merge join or hash join. Also that efficiency depending on the data strongly different. People start to understand that it is not simple select under a cowl a heap of algorithms and that SQL much more high-level than they thought. Then there is clear what primitive these 3 lines on F#. HBM>>> - complexities with code reusage. Or gives on performance, or  G>> the argument is not clear. HBM> that here not clear?  the available code in SQL it is the extremely difficult. Modularity is not present. You overestimate significance of the beautiful and convenient code, as well as many programmers. To the companies deeply to spit on that how much qualitative code. But here if they lose the data or at them something will brake - at once note. The inconvenient code - dares simply, we employ one more programmer and all... Too many programmers pursue "prettiness", too it overestimating. HBM> to write integration tests is more difficult and more unprofitable. Only they will test that happens actually, instead of .

15

Re: Business of the logician in

HBM>> the beautiful code the concept is finite rather. HBM>> I put in it more often laconicism. HBM>> if I can F# solve with the help the task 3 in the lines, and on SQL - 25 lines the choice is obvious to me G> Here only on F# at you not 3 lines turns out both not 30 and not 300 to receive analog. When you start to tell about escalation of locks, about isolation levels transaction, about that that the DBMS can select automatically nested loop or merge join or hash join. Also that efficiency depending on the data strongly different. People start to understand that it is not simple select under a cowl a heap of algorithms and that SQL much more high-level than they thought. Then there is clear what primitive these 3 lines on F#. There are tasks where this method of the decision will be the best. There are tasks when easier to lift what-thread cluster from 100 machines and  calculations. It can be easier and cheaper, than search abrupt  in a sequel. Better to say, it is necessary to use the suitable tool in each specific case. And at us a spherical horse in vacuum. HBM>> that here not clear?  the available code in SQL it is the extremely difficult. Modularity is not present. G> you overestimate significance of the beautiful and convenient code, as well as many programmers. To the companies deeply to spit on that how much qualitative code. But here if they lose the data or at them something will brake - at once note. The inconvenient code - dares simply, we employ one more programmer and all... G> too many programmers pursue "prettiness", too it overestimating. The bad code is difficult for supporting. When because of the bad code implementation of a new feature starts to occupy not 1 week, and month,  it notes where faster, because of  additional expenditures, rather than a difference in the response rest api between 400 and 600. HBM>> to write integration tests is more difficult and more unprofitable. G> Only they will test that happens actually, instead of . And you do not test  in units-tests and all will be good.

16

Re: Business of the logician in

Hello, HeBpuMHeCkaTuHa, you wrote: HBM> there are tasks where this method of the decision will be the best. HBM> there are tasks when easier to lift what-thread cluster from 100 machines and  calculations. Such tasks are not present. HBM> it can be easier and cheaper, than search abrupt  in a sequel. Often supporters of such decisions with an open mouth watch as an old notebook carries a crowd from 10 servers... What algorithms you use the Main thing, instead of how many at you machines. Which, by the way, also  it is necessary. HBM> better to say, it is necessary to use the suitable tool in each specific case. HBM> and at us a spherical horse in vacuum. Well set a specific example we disassemble - offer. Simply in itself forum the architecture implies  reasonings. HBM>>> that here not clear?  the available code in SQL it is the extremely difficult. Modularity is not present. G>> you overestimate significance of the beautiful and convenient code, as well as many programmers. To the companies deeply to spit on that how much qualitative code. But here if they lose the data or at them something will brake - at once note. The inconvenient code - dares simply, we employ one more programmer and all... G>> too many programmers pursue "prettiness", too it overestimating. HBM> the bad code is difficult for supporting. HBM> when because of the bad code implementation of a new feature starts to occupy not 1 week, and month,  it notes where faster, because of  additional expenditures, rather than a difference in the response rest api between 400 and 600. They try to employ some more programmers. Nobody will long listen to fairy tales about refactoring. HBM> and you do not test  in units-tests and all will be good. Well so I also suggest to do open testing.

17

Re: Business of the logician in

Hello, Gattaka, you wrote: HBM>> who hinders to pull out only that data which needs and be not to dragged the superfluous? G>  hinders. At me, we admit  the table on essence, and from this essence it is necessary for steam of columns for the report.  all essence pulls out and further you will work with that field that is necessary for you. The pair of columns for the report is for  not strongly problem. A problem - when it is necessary to transform the general account document from the big group of entities. Here is, of course, much easier (personally for me) to make procedure which sequentially would form the necessary sampling. And here for normal crud all the same  it is very convenient. I would not rush to extreme measures and used the joint decision:  + difficult samplings on sql

18

Re: Business of the logician in

Hello, Vasiliy2, you wrote: V> the Pair of columns for the report is for  not strongly problem. A problem - when it is necessary to transform the general account document from the big group of entities. Here is, of course, much easier (personally for me) to make procedure which sequentially would form the necessary sampling. And here for normal crud all the same  it is very convenient. I would not rush to extreme measures and used the joint decision:  + difficult samplings on sql I Divide your point of view completely. Here only it just also goes to a section with judgement that business of the logician in  it is bad. It I about those difficult samplings.

19

Re: Business of the logician in

HBM>> there are tasks where this method of the decision will be the best. HBM>> there are tasks when easier to lift what-thread cluster from 100 machines and  calculations. G> such tasks are not present. Is not present generally or not was specific in your company? HBM>> it can be easier and cheaper, than search abrupt  in a sequel. G> it is frequent supporters of such decisions with an open mouth watch as an old notebook carries a crowd from 10 servers... What algorithms you use the Main thing, instead of how many at you machines. Which, by the way, also  it is necessary. Machines  it is not necessary, all on the automatic machine. Horizontal scaling is always cheaper than the vertical. HBM>> better to say, it is necessary to use the suitable tool in each specific case. HBM>> and at us a spherical horse in vacuum. G> well set a specific example we disassemble - offer. Simply in itself forum the architecture implies  reasonings. Yes I do not have now such tasks. I'm fine HBM>> the bad code is difficult for supporting. HBM>> when because of the bad code implementation of a new feature starts to occupy not 1 week, and month,  it notes where faster, because of  additional expenditures, rather than a difference in the response rest api between 400 and 600. G> They try to employ some more programmers. Nobody will long listen to fairy tales about refactoring. And it leads as a result still to the big problems and temporal expenses. After all the bad code, and in particular, a technical debt, it as a snow clod. HBM>> and you do not test  in units-tests and all will be good. G> well so I also suggest to do open testing. Once again it is difficult. When it is necessary to test a simple case, you need to overtake for a heap of the coherent data, differently it will not work. And each test will be huge and heavily supported. So that most likely anybody will not write and support them.

20

Re: Business of the logician in

Hello, HeBpuMHeCkaTuHa, you wrote: HBM> is not present generally or not was specific in your company? The philosophers' stone is not present generally or was specific you it did not see? HBM>>> it can be easier and cheaper, than search abrupt  in a sequel. G>> it is frequent supporters of such decisions with an open mouth watch as an old notebook carries a crowd from 10 servers... What algorithms you use the Main thing, instead of how many at you machines. Which, by the way, also  it is necessary. HBM> machines  it is not necessary, all on the automatic machine. HBM> horizontal scaling is always cheaper than the vertical. I explain on fingers. At one of computers the disk fell down, at the second the Windows began update. What then?

21

Re: Business of the logician in

Hello, Gattaka, you wrote: G> Colleagues, whether G> So badly to implement business the logic in high-efficiency stored procedures?" High-efficiency stored procedures "it is an oxymoron. Typical application is CRUD. In simple application CRUD it is 100 % of all operation with basis, in difficult - not less than 60 % on my counts. High-efficiency data reading is under construction on a simple principle - as much as possible exact predicate (without everyones t is done. Field = @p or @p is null) for sampling and a minimum projection. It means that will be necessary for you or 100500 procedures for data reading, or to glue a line in SQL. Naturally anybody in senses so does not do and uses requests of a general view, with nonoptimal projections and predicates, receiving high-speed performance certainly is worse than that could be. As to change of the data, a pattern too not in favor of procedures. In case of change \adding \removal of single line no difference with requests from application is present. But if it is necessary to add \update \remove at once some lines ORM simply form  and send on the server, and it is necessary for procedure the data  in any xml\json or on  in tabular parameter. Then  parameter in procedure and only after that to fulfill operations. Naturally approach with procedures also is certainly nonoptimal. Real high performance in procedures is reached not in OLTP scenarios, and in OLAP when it is necessary to drive data arrays, it is desirable without their downloading in application. G> or now it is fashionable to use  type  which generate awful sql requests? Considering that the SQL text as a rule more  also is better read. The SQL text which more laconic also is better read has no relation to high performance.

22

Re: Business of the logician in

HBM>> machines  it is not necessary, all on the automatic machine. HBM>> horizontal scaling is always cheaper than the vertical. G> I explain on fingers. At one of computers the disk fell down, at the second the Windows began update. What then? In a case with one server of such problems cannot be? And if it one failed, what then? The chance that lays down all cluster is minimum. Yes, and in secret, the Windows on servers itself do not begin update

23

Re: Business of the logician in

Hello, Gattaka, you wrote: G> Hello, Sinix, you wrote: S>> About feng shui we will not be, it and without me tell. From the practical point of view - well it is possible, yes. In the presence of certain conditions, certainly. G> I about  would express "well it is possible, yes..." When you checked up generated request that  and this version  it more is less normally generated by this. And if not so it is critical  from basis of superfluous data volume to fill fields of essence which are not used. And what hinders to make a projection in ORM? All known to me ORM support projections and dynamic construction of requests. Only for religious reasons not all use it.

24

Re: Business of the logician in

Hello, HeBpuMHeCkaTuHa, you wrote: HBM>>> to optimize sql it is necessary when there are problems with performance. 90 % of operations of application it  CRUD, and with it any ORM perfectly consult. G>> nonsense. It is necessary to write the optimum code at once. Premature pessimization leads to projects, which and for half a year not . HBM> premature optimization not smaller harm. The code should be normal, but there is no sense to pursue for +1 % of performance. It is incorrect. When Dijkstra wrote about premature optimization it meant small khaki at level of separate commands of the processor which give an insignificant gain of high-speed performance, but considerably worsen readership. Partially same concerns a choice , it is better than type at first  the linear search, than to catch bugs in binary search with interpolation. But when we speak about high-level optimization - at level of data structures, component interactions, databases, it is necessary to optimize from the very beginning, differently then the correction price grows exponentially. Optimization SQL concerns just such type of optimization. I have a fine example. In 2008 when only appeared linq, I did a site and one person from my command was engaged in navigation creation. It was necessary to make nontrivial request which makes sampling. He/she is the person following the approach "then we optimize" wrote instead of advanced query pair foreach cycles. That Mahlo that received select n+1 so also the representation code was guided by objects of model, each of which demanded a raising on some KB of the text. As a result navigation was under construction half-seconds. I to it told that it is necessary to rewrite this business in request and to make a projection, but he told that it is a hogwash and is better we apply a cache. Also fastened a cache for objects of model. Then we on a site  the real data of the client also it turned out on creation of navigation of 8 seconds. Even it became inconvenient to debug, even  did not help, for the developer started from zero application almost every minute. As a result it was necessary to alter requests, to make DTO, to alter the representation code, to alter the mechanism . As a matter of fact to rewrite EVERYTHING that this programmer did. Here such price of nonoptimal requests. There is a situation of nonoptimal structure of a DB then it is necessary not to rewrite simply requests is even worse, but also given to pour and God forbid application works for the customer.

25

Re: Business of the logician in

Hello, HeBpuMHeCkaTuHa, you wrote: HBM> horizontal scaling is always cheaper than the vertical. In practice vertical is cheaper. And even banal calculations show it. We assume that the iron price grows linearly capacities. To scale the server horizontally to you it is necessary it . That is to buy the same disk set, the same processor, the same mother, as much storages. That is to incur double expenses. That it is not necessary to scale vertically all to buy in the double size because the system rests against something one. For example a disk or the processor, occasionally in storage. Therefore vertical scaling manages more cheaply. Besides at horizontal scaling costs on start of a system software grow. OS always eats a part of resources and the more at you computers, the eats OS more. In practice the price for iron grows more slowly, than linearly. 16  cost cheaper, than 2 on 8, the disk on  costs more cheaply two on 500 . The processor in 2 times is not twice more expensive than the slow faster. Certainly such dependence is saved not always if we take scales of Google or  there vertical  or it is physically impossible or costs strongly more than the horizontal. But it is Google and , such scales in life very few people can see. And vertical scaling is more favourable to normal applications. Esteem about stackoverflow, at their loadings they are scaled vertically in the core.