Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      CodeSOD: One Last ID

      September 24, 2025

      9 Ways AI Code Generation in React.js Reduces Technical Debt for Product Teams

      September 24, 2025

      GitHub details upcoming changes to improve security in wake of Shai-Hulud worm in npm ecosystem

      September 24, 2025

      Syncfusion restructures Essential Studio into multiple different suites to provide greater flexibility for developers

      September 24, 2025

      Distribution Release: Kali Linux 2025.3

      September 23, 2025

      Distribution Release: SysLinuxOS 13

      September 23, 2025

      Development Release: MX Linux 25 Beta 1

      September 22, 2025

      DistroWatch Weekly, Issue 1140

      September 21, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      A Stream-Oriented UI library for interactive web applications

      September 24, 2025
      Recent

      A Stream-Oriented UI library for interactive web applications

      September 24, 2025

      billboard.js 3.17.0: ✨ New Axis Customization, Label Styling & Image Labels!

      September 24, 2025

      AEM and Cloudflare Workers: The Ultimate Duo for Blazing Fast Pages

      September 24, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Distribution Release: Kali Linux 2025.3

      September 23, 2025
      Recent

      Distribution Release: Kali Linux 2025.3

      September 23, 2025

      Distribution Release: SysLinuxOS 13

      September 23, 2025

      How I Configure Polybar to Customize My Linux Desktop

      September 23, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Tech & Work»CodeSOD: One Last ID

    CodeSOD: One Last ID

    September 24, 2025

    Chris‘s company has an unusual deployment. They had a MySQL database hosted on Cloud Provider A. They hired a web development company, which wanted to host their website on Cloud Provider B. Someone said, “Yeah, this makes sense,” and wrote the web dev company a sizable check. They app was built, tested, and released, and everyone was happy.

    Everyone was happy until the first bills came in. They expected the data load for the entire month to be in the gigabytes range, based on their userbase and expected workloads. But for some reason, the data transfer was many terabytes, blowing up their operational budget for the year in a single month.

    Chris fired up a traffic monitor and saw that, yes, huge piles of data were getting shipped around with every request. Well, not every request. Every insert operation ended up retrieving a huge pile of data. A little more research was able to find the culprit:

    <span class="hljs-keyword">SELECT</span> last_insert_id() <span class="hljs-keyword">FROM</span> some_table_name
    

    The last_insert_id function is a useful one- it returns the last autogenerated ID in your transaction. So you can INSERT, and then check what ID was assigned to the inserted record. Great. But the way it’s meant to be used is like so: SELECT last_insert_id(). Note the lack of a FROM clause.

    By adding the FROM, what the developers were actually saying were “grab all rows from this table, and select the last_insert_id once for each one of them”. The value of last_insert_id() just got repeated once for each row, and there were a lot of rows. Many millions. So every time a user inserted a row into most tables, the database sent back a single number, repeated millions and millions of times. Each INSERT operation caused a 30MB reply. And when you have high enough traffic, that adds up quickly.

    On a technical level, it was an easy fix. On a practical one, it took six weeks to coordinate with the web dev company and their hosting setup to make the change, test the change, and deploy the change. Two of those weeks were simply spent convincing the company that yes, this was in fact happening, and yes, it was in fact their fault.

    [Advertisement]
    Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.

    Source: Read More 

    news
    Facebook Twitter Reddit Email Copy Link
    Previous Article9 Ways AI Code Generation in React.js Reduces Technical Debt for Product Teams
    Next Article Perficient Recognized as a Microsoft AI Business Solutions Inner Circle Partner

    Related Posts

    Tech & Work

    9 Ways AI Code Generation in React.js Reduces Technical Debt for Product Teams

    September 24, 2025
    Tech & Work

    GitHub details upcoming changes to improve security in wake of Shai-Hulud worm in npm ecosystem

    September 24, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    New BPFDoor Controller Enables Stealthy Lateral Movement in Linux Server Attacks

    Development

    Lessons from the Front: Configurable Workflow Rules for New Items in XM Cloud

    Development

    CVE-2025-6828 – Code-Projects Inventory Management System SQL Injection Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    More than €1.2 billion raised by EIC Scaling Club members

    News & Updates

    Highlights

    CVE-2022-47112 – 7-Zip XZ File Format Parsing Vulnerability

    April 20, 2025

    CVE ID : CVE-2022-47112

    Published : April 19, 2025, 9:15 p.m. | 1 day, 1 hour ago

    Description : 7-Zip 22.01 does not report an error for certain invalid xz files, involving stream flags and reserved bits. Some later versions are unaffected.

    Severity: 2.5 | LOW

    Visit the link for more details, such as CVSS details, affected products, timeline, and more…

    10 Best PC Games Under 2 GB to Install and Play

    July 4, 2025

    Building your first MCP server: How to extend AI tools with custom capabilities

    August 22, 2025

    CVE-2025-43950 – “Microsoft DPMAdirektPro DLL Hijacking Privilege Escalation Vulnerability”

    April 22, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.