{"id":32427,"date":"2026-03-12T12:35:58","date_gmt":"2026-03-12T19:35:58","guid":{"rendered":"https:\/\/www.pingcap.com\/?p=32427"},"modified":"2026-03-13T12:37:31","modified_gmt":"2026-03-13T19:37:31","slug":"why-you-should-replace-stored-procedures-with-a-service-layer","status":"publish","type":"post","link":"https:\/\/www.pingcap.com\/ko\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/","title":{"rendered":"Why You Should Replace Stored Procedures with a Service Layer"},"content":{"rendered":"<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Key_Takeaways\"><\/span><strong>Key Takeaways<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Stored procedures create deployment friction, version control drift, and observability gaps that worsen at scale.<\/li>\n\n\n\n<li>A service layer replaces them with testable, debuggable, independently scalable application code.<\/li>\n\n\n\n<li>Co-locating the service with the database preserves low latency while unlocking modern tooling and libraries.<\/li>\n\n\n\n<li>Migration can be incremental \u2014 start with new functionality and move existing procedures over as needed.<\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<p>If you&#8217;ve worked with relational databases long enough, you&#8217;ve almost certainly encountered stored procedures. They made sense in an era when network latency was expensive and applications were monolithic, but the world has moved on. In this post, we&#8217;ll look at why stored procedures are holding teams back and what a modern alternative looks like.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_Are_Stored_Procedures\"><\/span>What Are Stored Procedures?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Stored procedures are pieces of code that live inside the database itself, executed on demand via <code>CALL<\/code> statements, triggers, or scheduled events. In MySQL (and MySQL-compatible databases like TiDB), these are traditionally written in SQL\/PSM, a procedural extension of the SQL standard.<\/p>\n\n\n\n<p>MySQL&#8217;s commercial edition recently added JavaScript support for stored procedures, but the Community Edition \u2014 along with derivatives like AWS RDS \u2014 still only supports SQL\/PSM. Other databases such as PostgreSQL offer multi-language support, but the fundamental tradeoffs remain the same.<\/p>\n\n\n\n<p>Stored procedures have historically served two purposes: Acting as an abstraction layer so that multiple applications can share database logic without duplication, and reducing network roundtrips by bundling several SQL statements into a single server-side call.<\/p>\n\n\n\n<p>Both are legitimate goals. But the way stored procedures achieve them introduces a long list of operational problems.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"The_Case_Against_Stored_Procedures\"><\/span>The Case Against Stored Procedures<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Over time, stored procedures accumulate friction across nearly every dimension of the software development lifecycle:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Deployment and version control.<\/strong> Teams deploy stored procedures separately from the application code that depends on them, adding coordination overhead to every release and rollback. Worse, the version running in production often doesn&#8217;t match what&#8217;s in version control \u2014 if it&#8217;s in version control at all.<\/li>\n\n\n\n<li><strong>Language mismatch.<\/strong> Your application is written in Go, Java, or Python. Your stored procedures are written in SQL\/PSM. This means constant context-switching, separate tooling, and a smaller talent pool for reviewing database-side code.<\/li>\n\n\n\n<li><strong>Limited debugging, testing, and observability.<\/strong> Breakpoints? Rarely supported. Unit tests? Almost never done. Logging, metrics, and tracing? Stored procedures typically don&#8217;t integrate with any of it. The result is a growing body of untested, uninstrumented business logic hiding inside the database.<\/li>\n\n\n\n<li><strong>Constrained functionality.<\/strong> Need to call an external API, use a third-party library, or send a notification? Stored procedures offer very limited support, which often leads to duplicated validation logic across the database and application layers.<\/li>\n\n\n\n<li><strong>Weak tooling.<\/strong> IDE support for SQL\/PSM lags far behind mainstream languages. Code completion, refactoring, linters, and static analysis are either missing or rudimentary.<\/li>\n\n\n\n<li><strong>Performance and scalability limits.<\/strong> The database engine typically interprets stored procedures rather than compiling them, and they consume compute resources on the database server itself. In architectures with a single primary \u2014 common in MySQL deployments \u2014 this creates a scalability ceiling at exactly the wrong place.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"A_Modern_Alternative_to_Stored_Procedures_A_Service_Layer\"><\/span>A Modern Alternative to Stored Procedures: A Service Layer<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The solution is straightforward: Replace stored procedures with a dedicated <a href=\"https:\/\/en.wikipedia.org\/wiki\/Service_layer\">service layer<\/a> that owns the database access and exposes an HTTP (or gRPC) API to other applications. Instead of calling stored procedures over a SQL connection, applications call the service over HTTP.<\/p>\n\n\n\n<p>This unlocks several advantages at once:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Standard development practices.<\/strong> Your database logic is now regular application code. It lives in version control, goes through code review, gets tested in CI, and deploys through the same pipeline as everything else. Debugging is just debugging.<\/li>\n\n\n\n<li><strong>Language flexibility.<\/strong> Implement the service in whatever language makes the most sense \u2014 Go for performance, Python for rapid prototyping, or whatever your team already knows. You get full access to the language&#8217;s ecosystem of libraries, frameworks, and tooling.<\/li>\n\n\n\n<li><strong>Better security and auditability.<\/strong> A service layer gives you a natural place to add authentication, authorization, request logging, and audit trails. This is significantly harder to achieve inside the database.<\/li>\n\n\n\n<li><strong>Independent scalability.<\/strong> The service scales horizontally, separate from the database. You&#8217;re no longer constrained to the compute resources of a single database primary. This is especially powerful when paired with a distributed database like <a href=\"https:\/\/www.pingcap.com\/ko\/tidb\/\">\ud2f0DB<\/a>, where the storage layer already <a href=\"https:\/\/www.pingcap.com\/ko\/horizontal-scaling-vs-vertical-scaling\/\">scales horizontally<\/a> \u2014 now your application logic can too.<\/li>\n\n\n\n<li><strong>Improved performance.<\/strong> Compiled, optimized application code running in its own process will generally outperform interpreted SQL\/PSM executing inside the database engine.<\/li>\n\n\n\n<li><strong>Reduced roundtrips, done right.<\/strong> One of the original motivations for stored procedures was batching multiple SQL operations into a single call. A service achieves the same thing. It sits close to the database and handles multi-step operations internally, exposing a single clean API call to the outside world.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Architecture_Where_to_Place_the_Service\"><\/span>Architecture: Where to Place the Service<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The placement of your service relative to the database matters for latency.<\/p>\n\n\n\n<p>When an application talks directly to a remote database, every SQL roundtrip crosses the network. If the application is close to the end user but far from the database, latency accumulates quickly across multiple queries.<\/p>\n\n\n\n<p>A service layer solves this by co-locating with the database. The application makes a single HTTP call to the service, and the service handles all the SQL roundtrips over a fast local connection. The total end-to-end latency drops significantly.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"625\" src=\"https:\/\/static.pingcap.com\/files\/2026\/03\/13114342\/image-8-1024x625.png\" alt=\"A side-by-side comparison showing database architecture with stored procedures vs. a service layer.\" class=\"wp-image-32442\" srcset=\"https:\/\/static.pingcap.com\/files\/2026\/03\/13114342\/image-8-1024x625.png 1024w, https:\/\/static.pingcap.com\/files\/2026\/03\/13114342\/image-8-300x183.png 300w, https:\/\/static.pingcap.com\/files\/2026\/03\/13114342\/image-8-768x469.png 768w, https:\/\/static.pingcap.com\/files\/2026\/03\/13114342\/image-8-1536x938.png 1536w, https:\/\/static.pingcap.com\/files\/2026\/03\/13114342\/image-8.png 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><em>Figure 1. A side-by-side comparison showing database architecture with stored procedures vs. a service layer.<\/em><\/figcaption><\/figure>\n<\/div>\n\n\n<p>If a particular piece of logic is only consumed by one application, there&#8217;s an even simpler option: Just put the logic in that application. The service-layer pattern is most valuable when multiple consumers need to share the same database operations.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"A_Practical_Example\"><\/span>A Practical Example<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Consider a bookstore application with the following operations implemented as stored procedures:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>An <code>isbn13_valid<\/code> function that checks whether a string is a valid ISBN-13 code.<\/li>\n\n\n\n<li>An <code>add_book<\/code> procedure that inserts a book after validating its ISBN.<\/li>\n\n\n\n<li>A <code>set_price<\/code> procedure that updates a book&#8217;s price.<\/li>\n\n\n\n<li>A <code>sell_book<\/code> procedure that adjusts inventory and records the sale.<\/li>\n\n\n\n<li>A <code>books_json<\/code> view that returns the catalog as JSON documents.<\/li>\n<\/ul>\n\n\n\n<p>Migrated to a service, these become HTTP endpoints:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>GET \/api\/v1\/books<\/code> \u2014 returns the catalog in JSON.<\/li>\n\n\n\n<li><code>POST \/api\/v1\/buy<\/code> \u2014 processes a sale, updating inventory and recording the transaction.<\/li>\n<\/ul>\n\n\n\n<p>And the migration opens up possibilities that stored procedures simply couldn&#8217;t support. The ISBN validation, for example, could use a proper library (like Go&#8217;s ISBN package) to validate both ISBN-10 and ISBN-13 formats. It can also look up book metadata from an external API to auto-fill title, author, and other fields. A <code>set_price<\/code> endpoint could integrate with a currency exchange rate API to automatically convert prices across currencies.<\/p>\n\n\n\n<p>These kinds of enhancements are trivial in application code and effectively impossible inside a stored procedure.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Making_the_Move_from_Stored_Procedures_to_a_Service_Layer\"><\/span>Making the Move from Stored Procedures to a Service Layer<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Migrating away from stored procedures doesn&#8217;t have to happen all at once. A practical approach:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Inventory your stored procedures.<\/strong> Understand what each one does, which applications call it, and how critical it is.<\/li>\n\n\n\n<li><strong>Start with new functionality.<\/strong> Any new database logic should be built in the service layer from day one.<\/li>\n\n\n\n<li><strong>Migrate incrementally.<\/strong> Pick the stored procedures that cause the most pain \u2014 the ones that are hardest to test, most frequently changed, or most in need of features that SQL\/PSM can&#8217;t provide \u2014 and migrate those first.<\/li>\n\n\n\n<li><strong>Run in parallel.<\/strong> During migration, you can keep the stored procedure as a fallback while the service-layer version is validated in production.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Stored procedures were a reasonable solution to a set of problems that modern architectures solve more effectively. They trade development velocity, testability, observability, and scalability for a marginal reduction in network roundtrips \u2014 a tradeoff that rarely makes sense today.<\/p>\n\n\n\n<p>A service layer gives you the same benefits (shared logic, reduced roundtrips) without the operational baggage. And when that service is backed by a horizontally scalable database, you&#8217;ve removed the bottleneck from both sides of the equation.<\/p>\n\n\n\n<p>The best time to start migrating was years ago. The second best time is now.<\/p>\n\n\n\n<p><em>Ready to modernize your database architecture? <a href=\"https:\/\/tidbcloud.com\/free-trial\/?__hstc=86493575.783064bfcc857ae1a573df16c96a21a4.1767977986672.1773413026600.1773426599453.235&amp;__hssc=86493575.21.1773426599453&amp;__hsfp=ef5d7ef781d92d519fb04a5267e98d6c&amp;_gl=1*um01ry*_gcl_au*NzgzNDI4MDk1LjE3Njc5ODI1NzU.*_ga*MjUyOTQyMTU0LjE3Njc5Nzc5ODQ.*_ga_9FRXHHPYVY*czE3NzM0MjY1OTgkbzI1NiRnMSR0MTc3MzQzMDIwNiRqNjAkbDAkaDA.*_ga_3JVXJ41175*czE3NzM0MjY1OTgkbzI1OSRnMSR0MTc3MzQzMDMyMyRqNjAkbDAkaDE3NDM4Mjc2Njk.*_ga_ZEL0RNV6R2*czE3NzM0MjY3NDUkbzIzMSRnMSR0MTc3MzQzMDIwNiRqNjAkbDAkaDA.\">Try TiDB Cloud Starter for free<\/a> and see how a horizontally scalable database pairs with a service-layer approach.<\/em><\/p>","protected":false},"excerpt":{"rendered":"<p>If you&#8217;ve worked with relational databases long enough, you&#8217;ve almost certainly encountered stored procedures. They made sense in an era when network latency was expensive and applications were monolithic, but the world has moved on. In this post, we&#8217;ll look at why stored procedures are holding teams back and what a modern alternative looks like. [&hellip;]<\/p>\n","protected":false},"author":20,"featured_media":32469,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ub_ctt_via":"","footnotes":""},"categories":[6],"tags":[147,478,14,477,111],"class_list":["post-32427","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-engineering","tag-distributed-sql","tag-microservices","tag-mysql","tag-stored-procedures","tag-tidb"],"acf":[],"featured_image_src":"https:\/\/static.pingcap.com\/files\/2026\/03\/13122543\/tidb_feature_1800x600-2.png","author_info":{"display_name":"Dani\u00ebl van Eeden","author_link":"https:\/\/www.pingcap.com\/ko\/blog\/author\/daniel-van-eeden\/"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Stored Procedures: Why It&#039;s Time to Move to a Service Layer<\/title>\n<meta name=\"description\" content=\"Stored procedures create deployment friction and scalability limits. Learn why a service layer is the modern alternative for database logic.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pingcap.com\/ko\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Stored Procedures: Why It&#039;s Time to Move to a Service Layer\" \/>\n<meta property=\"og:description\" content=\"Stored procedures create deployment friction and scalability limits. Learn why a service layer is the modern alternative for database logic.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pingcap.com\/ko\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/\" \/>\n<meta property=\"og:site_name\" content=\"TiDB\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/facebook.com\/pingcap2015\" \/>\n<meta property=\"article:published_time\" content=\"2026-03-12T19:35:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-13T19:37:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/static.pingcap.com\/files\/2026\/03\/13122559\/tidb_1200x627-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2400\" \/>\n\t<meta property=\"og:image:height\" content=\"1254\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Dani\u00ebl van Eeden\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/static.pingcap.com\/files\/2026\/03\/13122613\/tidb_twitter_1600x900-1.png\" \/>\n<meta name=\"twitter:creator\" content=\"@PingCAP\" \/>\n<meta name=\"twitter:site\" content=\"@PingCAP\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dani\u00ebl van Eeden\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/\"},\"author\":{\"name\":\"Dani\u00ebl van Eeden\",\"@id\":\"https:\/\/www.pingcap.com\/#\/schema\/person\/e7f356ca823f7aa0615191786b00a4d2\"},\"headline\":\"Why You Should Replace Stored Procedures with a Service Layer\",\"datePublished\":\"2026-03-12T19:35:58+00:00\",\"dateModified\":\"2026-03-13T19:37:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/\"},\"wordCount\":1353,\"publisher\":{\"@id\":\"https:\/\/www.pingcap.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/static.pingcap.com\/files\/2026\/03\/13122543\/tidb_feature_1800x600-2.png\",\"keywords\":[\"Distributed SQL\",\"Microservices\",\"MySQL\",\"Stored Procedures\",\"TiDB\"],\"articleSection\":[\"Engineering\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/\",\"url\":\"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/\",\"name\":\"Stored Procedures: Why It's Time to Move to a Service Layer\",\"isPartOf\":{\"@id\":\"https:\/\/www.pingcap.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/static.pingcap.com\/files\/2026\/03\/13122543\/tidb_feature_1800x600-2.png\",\"datePublished\":\"2026-03-12T19:35:58+00:00\",\"dateModified\":\"2026-03-13T19:37:31+00:00\",\"description\":\"Stored procedures create deployment friction and scalability limits. Learn why a service layer is the modern alternative for database logic.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/#primaryimage\",\"url\":\"https:\/\/static.pingcap.com\/files\/2026\/03\/13122543\/tidb_feature_1800x600-2.png\",\"contentUrl\":\"https:\/\/static.pingcap.com\/files\/2026\/03\/13122543\/tidb_feature_1800x600-2.png\",\"width\":3600,\"height\":1200},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pingcap.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Why You Should Replace Stored Procedures with a Service Layer\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pingcap.com\/#website\",\"url\":\"https:\/\/www.pingcap.com\/\",\"name\":\"TiDB\",\"description\":\"TiDB | SQL at Scale\",\"publisher\":{\"@id\":\"https:\/\/www.pingcap.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.pingcap.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.pingcap.com\/#organization\",\"name\":\"PingCAP\",\"url\":\"https:\/\/www.pingcap.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/www.pingcap.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/static.pingcap.com\/files\/2021\/11\/pingcap-logo.png\",\"contentUrl\":\"https:\/\/static.pingcap.com\/files\/2021\/11\/pingcap-logo.png\",\"width\":811,\"height\":232,\"caption\":\"PingCAP\"},\"image\":{\"@id\":\"https:\/\/www.pingcap.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/facebook.com\/pingcap2015\",\"https:\/\/x.com\/PingCAP\",\"https:\/\/linkedin.com\/company\/pingcap\",\"https:\/\/youtube.com\/channel\/UCuq4puT32DzHKT5rU1IZpIA\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.pingcap.com\/#\/schema\/person\/e7f356ca823f7aa0615191786b00a4d2\",\"name\":\"Dani\u00ebl van Eeden\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/www.pingcap.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/static.pingcap.com\/files\/2022\/10\/17234942\/avatar.jpg\",\"contentUrl\":\"https:\/\/static.pingcap.com\/files\/2022\/10\/17234942\/avatar.jpg\",\"caption\":\"Dani\u00ebl van Eeden\"},\"description\":\"Technical Support Engineer\",\"url\":\"https:\/\/www.pingcap.com\/ko\/blog\/author\/daniel-van-eeden\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Stored Procedures: Why It's Time to Move to a Service Layer","description":"Stored procedures create deployment friction and scalability limits. Learn why a service layer is the modern alternative for database logic.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pingcap.com\/ko\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/","og_locale":"ko_KR","og_type":"article","og_title":"Stored Procedures: Why It's Time to Move to a Service Layer","og_description":"Stored procedures create deployment friction and scalability limits. Learn why a service layer is the modern alternative for database logic.","og_url":"https:\/\/www.pingcap.com\/ko\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/","og_site_name":"TiDB","article_publisher":"https:\/\/facebook.com\/pingcap2015","article_published_time":"2026-03-12T19:35:58+00:00","article_modified_time":"2026-03-13T19:37:31+00:00","og_image":[{"width":2400,"height":1254,"url":"https:\/\/static.pingcap.com\/files\/2026\/03\/13122559\/tidb_1200x627-1.png","type":"image\/png"}],"author":"Dani\u00ebl van Eeden","twitter_card":"summary_large_image","twitter_image":"https:\/\/static.pingcap.com\/files\/2026\/03\/13122613\/tidb_twitter_1600x900-1.png","twitter_creator":"@PingCAP","twitter_site":"@PingCAP","twitter_misc":{"Written by":"Dani\u00ebl van Eeden","Est. reading time":"7\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/#article","isPartOf":{"@id":"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/"},"author":{"name":"Dani\u00ebl van Eeden","@id":"https:\/\/www.pingcap.com\/#\/schema\/person\/e7f356ca823f7aa0615191786b00a4d2"},"headline":"Why You Should Replace Stored Procedures with a Service Layer","datePublished":"2026-03-12T19:35:58+00:00","dateModified":"2026-03-13T19:37:31+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/"},"wordCount":1353,"publisher":{"@id":"https:\/\/www.pingcap.com\/#organization"},"image":{"@id":"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/#primaryimage"},"thumbnailUrl":"https:\/\/static.pingcap.com\/files\/2026\/03\/13122543\/tidb_feature_1800x600-2.png","keywords":["Distributed SQL","Microservices","MySQL","Stored Procedures","TiDB"],"articleSection":["Engineering"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/","url":"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/","name":"Stored Procedures: Why It's Time to Move to a Service Layer","isPartOf":{"@id":"https:\/\/www.pingcap.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/#primaryimage"},"image":{"@id":"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/#primaryimage"},"thumbnailUrl":"https:\/\/static.pingcap.com\/files\/2026\/03\/13122543\/tidb_feature_1800x600-2.png","datePublished":"2026-03-12T19:35:58+00:00","dateModified":"2026-03-13T19:37:31+00:00","description":"Stored procedures create deployment friction and scalability limits. Learn why a service layer is the modern alternative for database logic.","breadcrumb":{"@id":"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/"]}]},{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/#primaryimage","url":"https:\/\/static.pingcap.com\/files\/2026\/03\/13122543\/tidb_feature_1800x600-2.png","contentUrl":"https:\/\/static.pingcap.com\/files\/2026\/03\/13122543\/tidb_feature_1800x600-2.png","width":3600,"height":1200},{"@type":"BreadcrumbList","@id":"https:\/\/www.pingcap.com\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pingcap.com\/"},{"@type":"ListItem","position":2,"name":"Why You Should Replace Stored Procedures with a Service Layer"}]},{"@type":"WebSite","@id":"https:\/\/www.pingcap.com\/#website","url":"https:\/\/www.pingcap.com\/","name":"\ud2f0DB","description":"TiDB | SQL at Scale","publisher":{"@id":"https:\/\/www.pingcap.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pingcap.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/www.pingcap.com\/#organization","name":"PingCAP","url":"https:\/\/www.pingcap.com\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.pingcap.com\/#\/schema\/logo\/image\/","url":"https:\/\/static.pingcap.com\/files\/2021\/11\/pingcap-logo.png","contentUrl":"https:\/\/static.pingcap.com\/files\/2021\/11\/pingcap-logo.png","width":811,"height":232,"caption":"PingCAP"},"image":{"@id":"https:\/\/www.pingcap.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/facebook.com\/pingcap2015","https:\/\/x.com\/PingCAP","https:\/\/linkedin.com\/company\/pingcap","https:\/\/youtube.com\/channel\/UCuq4puT32DzHKT5rU1IZpIA"]},{"@type":"Person","@id":"https:\/\/www.pingcap.com\/#\/schema\/person\/e7f356ca823f7aa0615191786b00a4d2","name":"Dani\u00ebl van Eeden","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.pingcap.com\/#\/schema\/person\/image\/","url":"https:\/\/static.pingcap.com\/files\/2022\/10\/17234942\/avatar.jpg","contentUrl":"https:\/\/static.pingcap.com\/files\/2022\/10\/17234942\/avatar.jpg","caption":"Dani\u00ebl van Eeden"},"description":"Technical Support Engineer","url":"https:\/\/www.pingcap.com\/ko\/blog\/author\/daniel-van-eeden\/"}]}},"grav_blocks":false,"card_markup":"<a class=\"card-resource bg-white\" href=\"https:\/\/www.pingcap.com\/ko\/blog\/why-you-should-replace-stored-procedures-with-a-service-layer\/\"><div class=\"card-resource__image-container\"><img class=\"card-resource__image\" alt=\"tidb_feature_1800x600\" src=\"https:\/\/static.pingcap.com\/files\/2026\/03\/13122543\/tidb_feature_1800x600-2.png\" loading=\"lazy\" width=3600 height=1200 \/><\/div><div class=\"card-resource__content-container\"><div class=\"card-resource__content-head\"><div class=\"card-resource__category\">Engineering<\/div><\/div><h5 class=\"card-resource__title\">Why You Should Replace Stored Procedures with a Service Layer<\/h5><\/div><\/a>","_links":{"self":[{"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/posts\/32427","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/comments?post=32427"}],"version-history":[{"count":25,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/posts\/32427\/revisions"}],"predecessor-version":[{"id":32478,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/posts\/32427\/revisions\/32478"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/media\/32469"}],"wp:attachment":[{"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/media?parent=32427"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/categories?post=32427"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/tags?post=32427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}