New package leventcz/laravel-top: Real-time monitoring from the command line for Laravel applications. https://t.co/lrgWmTj7iZ
Just run "php artisan top" and see the metrics.
🔥 Most applications need to export and import large amounts of data.
It is very easy to:
- Waste lots of memory
- Perform hundreds or thousands of unnecessary DB queries
You can avoid them by learning some pretty simple techniques.
🧵 Keep Reading
Hey! I wrote a small article on fine-tuning PHP and PHP-FPM: https://t.co/NK9iaPzP4S
It's pretty simple. No black magic.
P.S: I wrote this after spending 5 hours trying to record a video on the same subject, so I was tired 😅. I'll review and rewrite some bits later.
After 8 months of planning, 12 hours of filming, and 2 weeks of editing, my biggest project has been released.
The Modern Full-Stack React Tutorial is now live, FOR FREE, on my YouTube channel
5 books I can't recommend enough:
1. Clean Architecture ( @unclebobmartin )
2. Building Microservices ( @samnewman )
3. Unit Testing ( @vkhorikov )
4. Domain Driven Design ( @ericevans0 )
5. Head First Design Patterns ( @erictfree & @elisabethrobson )
My favorite: Building Microservices, for how well it explains all aspects regarding the move to a microservices-based architecture.
Links:
1. Clean Architecture: https://t.co/6G7B5kcfTU
2. Building Microservices: https://t.co/X4rwOrOMbs
3. Unit Testing: https://t.co/ohXGYG809O
4. Domain Driven Design: https://t.co/sCt2OpFyuQ
5. Head First Design Patterns: https://t.co/uWJc9uNWH3
What should I read next?
𝗕𝗼𝗼𝗸𝘀 𝗘𝘃𝗲𝗿𝘆 𝗦𝗼𝗳𝘁𝘄𝗮𝗿𝗲 𝗘𝗻𝗴𝗶𝗻𝗲𝗲𝗿 𝗠𝘂𝘀𝘁 𝗥𝗲𝗮𝗱 𝗶𝗻 𝟮𝟬𝟮𝟰.
You probably already noticed that I'm a big fan of reading. I usually read 3-4 books per month. There are two ways to learn from knowledgeable people: to work directly with them or to read what they have written. The first option is the best, yet it is often impossible to do. So, we have books written by people who are probably the best at this in the world at the time of writing.
If we look at the software engineering world, there are many gems here, but I will recommend the best books per area of work. These books will help you not only to become good at specific technology but to become a great software engineer overall.
𝟭. 𝗚𝗲𝗻𝗲𝗿𝗮𝗹:
🔹 The Pragmatic Programmer by David Thomas and Andrew Hunt (https://t.co/NCSpr3ZhGb)
🔹 Code Complete: A Practical Handbook of Software Construction (https://t.co/OXMYyabHma)
🔹 Modern Software Engineering by David Farley (https://t.co/2X5eWCHcni)
🔹 Software Engineering at Google (Free - https://t.co/GXZxoCbrva)
𝟮. 𝗖𝗼𝗱𝗶𝗻𝗴 𝗽𝗿𝗮𝗰𝘁𝗶𝗰𝗲𝘀:
🔹 Clean Code by Uncle Bob Martin (https://t.co/4Ml52XBKKb)
🔹 Head First Design Patterns by Eric Freeman (https://t.co/4jXkPd8vcK)
🔹 Refactoring by Martin Fowler (https://t.co/8fbR93LNy0)
𝟯. 𝗗𝗮𝘁𝗮 𝘀𝘁𝗿𝘂𝗰𝘁𝘂𝗿𝗲𝘀 𝗮𝗻𝗱 𝗮𝗹𝗴𝗼𝗿𝗶𝘁𝗵𝗺𝘀:
🔹 Grokking Algorithms by Aditya Bhargava (https://t.co/1q2hWfaONO)
𝟰. 𝗗𝗮𝘁𝗮:
🔹 Learning SQL by Alan Beaulieu (Free - https://t.co/44iy3v91JQ)
𝟱. 𝗧𝗲𝘀𝘁𝗶𝗻𝗴:
🔹 Growing OO Software by Tests by Steve Freeman (https://t.co/joi6Q8nm4W)
🔹 TDD by Example by Kent Beck (https://t.co/IxVGfJymQu)
🔹 Unit Testing Principles, Practices, and Patterns by Vladimir Khorikov (https://t.co/7VyFPkUpZS)
🔹 The Art of Unit Testing by Roy Osherove (https://t.co/rqNoqJH49t)
𝟲. 𝗔𝗿𝗰𝗵𝗶𝘁𝗲𝗰𝘁𝘂𝗿𝗲:
🔹 Fundamentals Of Software Architecture by Mark Richards and Neil Ford (https://t.co/LOnF7783bl)
🔹 A Philosophy of Software Design by John Ousterhout (https://t.co/rBeKHE0w6P)
🔹 Clean Architecture by Uncle Bob Martin (https://t.co/fojqHumHo3)
🔹 Domain-Driven Design Distilled by Vaughn Vernon (https://t.co/pT8GZQmrR5)
🔹 Software Architecture the Hard Parts (https://t.co/K7AqvDOoSN)
𝟳. 𝗗𝗶𝘀𝘁𝗿𝗶𝗯𝘂𝘁𝗲𝗱 𝘀𝘆𝘀𝘁𝗲𝗺𝘀:
🔹 Understanding Distributed Systems by Roberto Vitillo (https://t.co/NmApvbFyQj)
🔹 Designing Data-Intensive Applications by Martin Kleppman (https://t.co/2Rtjfs987o)
𝟴. 𝗗𝗲𝘃𝗢𝗽𝘀:
🔹 DevOps Handbook by Gene Kim (https://t.co/EHmuVxZrKi)
🔹 Continuous Delivery by Jez Humble and David Farley (https://t.co/tePOX3hfs3)
🔹 Accelerate by Nicole Forsgren (https://t.co/HqHfEjAmB4)
𝟵. 𝗧𝗲𝗰𝗵-𝘀𝗽𝗲𝗰𝗶𝗳𝗶𝗰:
🔹 C# in Depth by Jon Skeet (https://t.co/u4M31XN673)
🔹 Effective Java by Joshua Bloch (https://t.co/5yc8S6sMS3)
🔹 Fluent Python (https://t.co/IO5IFIuXOb)
𝟭𝟬. 𝗠𝗮𝗰𝗵𝗶𝗻𝗲 𝗹𝗲𝗮𝗿𝗻𝗶𝗻𝗴:
🔹 The Hundred-Page Machine Learning Book (https://t.co/31A2XuGKSR)
🔹 Designing Machine Learning Systems (https://t.co/8hXFovtTzU)
𝟭𝟭. 𝗟𝗲𝗮𝗱𝗲𝗿𝘀𝗵𝗶𝗽:
🔹 The Five Dysfunctions of a Team by Patrick Lencioni (https://t.co/bKS3xhjCQv)
🔹 Drive by Daniel Pink (https://t.co/GVyKMoAkUu)
🔹 The Making of a Manager by Julie Zhuo (https://t.co/BiiOaJFmKz)
𝟭𝟮. 𝗣𝗲𝗿𝘀𝗼𝗻𝗮𝗹 𝗱𝗲𝘃𝗲𝗹𝗼𝗽𝗺𝗲𝗻𝘁:
🔹 How to Win Friends & Influence People (https://t.co/zKnkSvI4hv)
🔹 Deep Work (https://t.co/bOLnphk2Z4)
#softwareengineering
🔥 Laravel 11 is coming soon
Some of the changes include:
- New folder structure
- Changes in the bootstrapping process
- Less config
- Eager load limit
- casts function
- once function
🧵 Keep Reading
🔥 Laravel Tip: Enums don't have to just be a list of constants. You can add methods to them. Why not add one to check an instance's value? Or add one to share extra data with your front-end... then it becomes a source of truth / avoids duplication.
𝗧𝗼𝗽 𝟮𝟬 𝗦𝗤𝗟 𝗾𝘂𝗲𝗿𝘆 𝗼𝗽𝘁𝗶𝗺𝗶𝘇𝗮𝘁𝗶𝗼𝗻 𝘁𝗲𝗰𝗵𝗻𝗶𝗾𝘂𝗲𝘀
Here is the list of the top 20 SQL query optimization techniques I found noteworthy:
1. Create an index on huge tables (>1.000.000) rows
2. Use EXIST() instead of COUNT() to find an element in the table
3. SELECT fields instead of using SELECT *
4. Avoid Subqueries in WHERE Clause
5. Avoid SELECT DISTINCT where possible
6. Use WHERE Clause instead of HAVING
7. Create joins with INNER JOIN (not WHERE)
8. Use LIMIT to sample query results
9. Use UNION ALL instead of UNION wherever possible
10. Use UNION where instead of WHERE ... or ... query.
11. Run your query during off-peak hours
12. Avoid using OR in join queries
14. Choose GROUP BY over window functions
15. Use derived and temporary tables
16. Drop the index before loading bulk data
16. Use materialized views instead of views
17. Avoid != or <> (not equal) operator
18. Minimize the number of subqueries
19. Use INNER join as little as possible when you can get the same output using LEFT/RIGHT join.
20. Frequently try to use temporary sources to retrieve the same dataset.
Do you know what is 𝗤𝘂𝗲𝗿𝘆 𝗢𝗽𝘁𝗶𝗺𝗶𝘇𝗲𝗿? Its primary function is to determine 𝘁𝗵𝗲 𝗺𝗼𝘀𝘁 𝗲𝗳𝗳𝗶𝗰𝗶𝗲𝗻𝘁 𝘄𝗮𝘆 to execute a given SQL query by finding the best execution plan. The query optimizer takes the SQL query as input and analyzes it to determine how best to execute it. The first step is to parse the SQL query and create a syntax tree. The optimizer then analyzes the syntax tree to determine how to run the query.
Next, the optimizer generates 𝗮𝗹𝘁𝗲𝗿𝗻𝗮𝘁𝗶𝘃𝗲 𝗲𝘅𝗲𝗰𝘂𝘁𝗶𝗼𝗻 𝗽𝗹𝗮𝗻𝘀, which are different ways of executing the same query. Each execution plan specifies the order in which the tables should be accessed, the join methods, and any filtering or sorting operations. The optimizer then assigns a 𝗰𝗼𝘀𝘁 to each execution plan based on the number of disk reads and the CPU time required to execute the query.
Finally, the optimizer 𝗰𝗵𝗼𝗼𝘀𝗲𝘀 𝘁𝗵𝗲 𝗲𝘅𝗲𝗰𝘂𝘁𝗶𝗼𝗻 𝗽𝗹𝗮𝗻 with the lowest cost as the optimal execution plan for the query. This plan is then used to execute the query.
Check in the image the 𝗼𝗿𝗱𝗲𝗿 𝗶𝗻 𝘄𝗵𝗶𝗰𝗵 𝗦𝗤𝗟 𝗾𝘂𝗲𝗿𝗶𝗲𝘀 𝗿𝘂𝗻.
#technology #softwareengineering #programming #techworldwithmilan #sql
🤯 Holy moly!
STOP EVERYTHING ✋🏼🛑
You can use CASE in MySQL virtual columns
If your status columns need to be based on complex logic rather than a simple value, this is a really nice way to encode that at the DB layer