python - Should I use complex SQL queries or process results in the application? -


I am working with an application with huge SQL queries. They are so complex that when I understand, I have already forgotten how it started.

I was wondering if it would be a good practice to pull more data from the database and make the last query in my code, say, are I crazy with Python? Will it be bad for performance?

Note, the results are too big, I am talking about an ERP in the production developed by other people.

I will have business logic in the application, as much as possible. It is difficult to maintain complicated business logic in questions. ( When I end up understanding one, I have already forgotten how it has started ) Complex logic is well in stored procedures. But with a specific python app, you want to keep your business logic in the python.

Now, the database is better to handle data from your application code. So if your logic contains a large amount of data, then you can get better performance with the logic in the database. But this will be complicated reports, bookkeeping operations and so on, which works on large amounts of data. You may want to use stored procedures or systems that specialize in such operations (data warehouse for reports) for this type of operation.

General OLTP operations do not contain much information. The database can be very large, but the data needed for a specific transaction (usually) will be a very small part of it. This can be performance issues due to inquiries in a large database, but you can customize it in many ways (indexes, full text searches, redundancy, summary tables ... depending on your actual problem).

As each rule exception, but as a general guidelines , try to put your business logic in your application code. A set of separate data warehouses or processes for reporting stored procedures for complex logic

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -