{"id":91048,"date":"2020-08-08T01:42:02","date_gmt":"2020-08-07T23:42:02","guid":{"rendered":"https:\/\/prohoster.info\/blog\/administrirovanie\/ne-stoit-polzovatsya-offset-i-limit-v-zaprosah-s-razbieniem-na-straniczy"},"modified":"2020-08-08T01:42:02","modified_gmt":"2020-08-07T23:42:02","slug":"ne-stoit-polzovatsya-offset-i-limit-v-zaprosah-s-razbieniem-na-straniczy","status":"publish","type":"post","link":"https:\/\/prohoster.info\/da\/blog\/administrirovanie\/ne-stoit-polzovatsya-offset-i-limit-v-zaprosah-s-razbieniem-na-straniczy","title":{"rendered":"Det er ikke en god id\u00e9 at bruge OFFSET og LIMIT i foresp\u00f8rgsler med paginering","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>De dage, hvor man ikke beh\u00f8vede at bekymre sig om optimering af databaseydelse, er forbi. Tiden st\u00e5r ikke stille. Hver ny iv\u00e6rks\u00e6tter inden for teknologi \u00f8nsker at skabe det n\u00e6ste Facebook og str\u00e6ber efter at indsamle alle de data, de kan f\u00e5 fat i. Disse data er afg\u00f8rende for at forbedre modellerne, som hj\u00e6lper med at generere indt\u00e6gter. Under s\u00e5danne forhold er det n\u00f8dvendigt for udviklere at skabe API'er, der g\u00f8r det muligt at arbejde hurtigt og p\u00e5lideligt med store m\u00e6ngder information.<\/p>\n<p><noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/513766\/\"><img decoding=\"async\" alt=\"Det er ikke en god id\u00e9 at bruge OFFSET og LIMIT i foresp\u00f8rgsler med paginering\" src=\"\/wp-content\/uploads\/2020\/08\/28dc2f07d0afe039356e75a098eefde8.png\" style=\"display:block;margin: 0 auto;\" \/><\/a><\/noindex><br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><br \/>\nHvis du i et stykke tid har arbejdet med design af serverkomponenter til applikationer eller databaser, har du sikkert skrevet kode til at udf\u00f8re foresp\u00f8rgsler med paginering. For eksempel s\u00e5dan her:<\/p>\n<pre><code class=\"plaintext\">SELECT * FROM table_name LIMIT 10 OFFSET 40\n<\/code><\/pre>\n<p>\nEr det rigtigt?<\/p>\n<p>Men hvis du har udf\u00f8rt paginering p\u00e5 netop den m\u00e5de, m\u00e5 jeg desv\u00e6rre sige, at du ikke har gjort det p\u00e5 den mest effektive m\u00e5de.<\/p>\n<p>Vil du udfordre mig? <noindex><a rel=\"nofollow\" href=\"https:\/\/mariadb.com\/kb\/en\/pagination-optimization\/\">Du kan<\/a><\/noindex> <noindex><a rel=\"nofollow\" href=\"https:\/\/use-the-index-luke.com\/sql\/partial-results\/fetch-next-page\">ikke<\/a><\/noindex> <noindex><a rel=\"nofollow\" href=\"https:\/\/www.eversql.com\/faster-pagination-in-mysql-why-order-by-with-limit-and-offset-is-slow\/\">bruge<\/a><\/noindex> <noindex><a rel=\"nofollow\" href=\"https:\/\/www.slideshare.net\/Eweaver\/efficient-pagination-using-mysql\">tidsstempel<\/a><\/noindex>. <noindex><a rel=\"nofollow\" href=\"https:\/\/slack.engineering\/evolving-api-pagination-at-slack-1c1f644f8e12\">Slack<\/a><\/noindex>, <noindex><a rel=\"nofollow\" href=\"https:\/\/engineering.shopify.com\/blogs\/engineering\/pagination-relative-cursors\">Shopify<\/a><\/noindex> og <noindex><a rel=\"nofollow\" href=\"https:\/\/engineering.mixmax.com\/blog\/api-paging-built-the-right-way\/\">Mixmax<\/a><\/noindex> bruger allerede de teknikker, jeg vil tale om i dag.<\/p>\n<p>N\u00e6vn bare \u00e9n backend-udvikler, der aldrig har brugt <code>OFFSET<\/code> og <code>LIMIT<\/code> til at udf\u00f8re foresp\u00f8rgsler med paginering. I et MVP (Minimum Viable Product) og i projekter, hvor der bruges sm\u00e5 datam\u00e6ngder, er denne tilgang helt anvendelig. Den, s\u00e5 at sige, \"bare virker\".<\/p>\n<p>Men hvis du skal skabe p\u00e5lidelige og effektive systemer fra bunden, er det vigtigt at t\u00e6nke p\u00e5 effektiviteten af foresp\u00f8rgsler til de databaser, der bruges i s\u00e5danne systemer.<\/p>\n<p>I dag vil vi tale om de problemer, der er forbundet med de udbredte (desv\u00e6rre) implementeringer af mekanismer til at udf\u00f8re foresp\u00f8rgsler med paginering, og hvordan man kan opn\u00e5 h\u00f8j ydeevne, n\u00e5r man udf\u00f8rer s\u00e5danne foresp\u00f8rgsler.<\/p>\n<h2>Hvad er galt med OFFSET og LIMIT?<\/h2>\n<p>\nSom allerede n\u00e6vnt, <code>OFFSET<\/code> og <code>LIMIT<\/code> fungerer glimrende i projekter, hvor man ikke skal arbejde med store datam\u00e6ngder.<\/p>\n<p>Problemet opst\u00e5r, n\u00e5r databasen vokser til en s\u00e5dan st\u00f8rrelse, at den ikke l\u00e6ngere kan rumme i serverens hukommelse. Men samtidig er det n\u00f8dvendigt at bruge foresp\u00f8rgsler med paginering for at arbejde med denne database.<\/p>\n<p>For this problem to manifest, a situation must arise where the DBMS resorts to inefficient full table scan operations when executing each paginated query (at the same time, there may be operations for inserting and deleting data, and we do not need outdated data!).<\/p>\n<p>What is a \"full table scan\" (or \"sequential table scan\")? This is an operation where the DBMS sequentially reads each row of the table, that is, the data contained within it, and checks it against specified conditions. It is known that this type of table scanning is the slowest. The reason is that it involves a lot of input\/output operations affecting the server's disk subsystem. The situation is worsened by the delays associated with working with data stored on disks and the fact that transferring data from disk to memory is a resource-intensive operation.<\/p>\n<p>For example, you have records of 100,000,000 users, and you execute a query with the clause <code>OFFSET 50,000,000<\/code>. This means that the DBMS will have to load all these records (which we do not even need!), place them in memory, and only after that retrieve, say, 20 results as stated in the <code>LIMIT<\/code>.<\/p>\n<p>Let's say it might look like this: \"select rows from 50,000 to 50,020 out of 100,000\". So, the system will first need to load 50,000 rows to execute the query. Do you see how much unnecessary work it has to perform?<\/p>\n<p>If you don't believe it, take a look at the example I created using the capabilities of <noindex><a rel=\"nofollow\" href=\"https:\/\/www.db-fiddle.com\/f\/3JSpBxVgcqL3W2AzfRNCyq\/1\">db-fiddle.com<\/a><\/noindex>.\u00a0<\/p>\n<p><img decoding=\"async\" alt=\"Det er ikke en god id\u00e9 at bruge OFFSET og LIMIT i foresp\u00f8rgsler med paginering\" src=\"\/wp-content\/uploads\/2020\/08\/b83c4e9c63e9bab341a13480be571940.png\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<i>Example on db-fiddle.com<\/i><\/p>\n<p>There, on the left, in the <code>Schema SQL<\/code>, there is code that inserts 100,000 rows into the database, and on the right, in the <code>Query SQL<\/code>, two queries are shown. The first, slow one, looks like this:<\/p>\n<pre><code class=\"plaintext\">SELECT *\nFROM `docs`\nLIMIT 10 OFFSET 85,000;\n<\/code><\/pre>\n<p>\nAnd the second, which represents an efficient solution to the same task, looks like this:<\/p>\n<pre><code class=\"plaintext\">SELECT *\nFROM `docs`\nWHERE id &gt; 85,000\nLIMIT 10;\n<\/code><\/pre>\n<p>\nTo execute these queries, it is enough to click the button <code>K\u00f8r<\/code> \u00f8verst p\u00e5 siden. N\u00e5r det er gjort, sammenligner vi oplysningerne om foresp\u00f8rgsels execution tid. Det viser sig, at en ineffektiv foresp\u00f8rgsel tager mindst 30 gange l\u00e6ngere tid end at udf\u00f8re den anden (fra k\u00f8rsel til k\u00f8rsel varierer denne tid, for eksempel kan systemet rapportere, at den f\u00f8rste foresp\u00f8rgsel tog 37 ms, mens den anden tog 1 ms).<\/p>\n<p>Og hvis dataene bliver st\u00f8rre, vil det se endnu v\u00e6rre ud (for at overbevise dig selv \u2014 se p\u00e5 min <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/IvoPereira\/Efficient-Pagination-SQL-PoC\">eksempel<\/a><\/noindex> med 10 millioner r\u00e6kker).<\/p>\n<p>Det, vi lige har diskuteret, skal give dig en vis forst\u00e5else af, hvordan foresp\u00f8rgsler til databaser faktisk bliver behandlet.<\/p>\n<p>T\u00e6nk p\u00e5, at jo st\u00f8rre v\u00e6rdien er, <code>OFFSET<\/code> jo l\u00e6ngere tid vil foresp\u00f8rgslen tage.<\/p>\n<h2>Hvad skal man i stedet bruge for kombinationen OFFSET og LIMIT?<\/h2>\n<p>\nI stedet for kombinationen <code>OFFSET<\/code> og <code>LIMIT<\/code> skal du bruge en konstruktion bygget efter denne skabelon:<\/p>\n<pre><code class=\"plaintext\">SELECT * FROM table_name WHERE id &gt; 10 LIMIT 20\n<\/code><\/pre>\n<p>\nDette er en udf\u00f8relse af foresp\u00f8rgslen med paginering baseret p\u00e5 en cursor (Cursor based pagination).<\/p>\n<p>I stedet for at gemme de aktuelle <code>OFFSET<\/code> og <code>LIMIT<\/code> og overf\u00f8re dem med hver foresp\u00f8rgsel, skal du gemme den sidst modtagne prim\u00e6re n\u00f8gle (normalt er dette <code>ID<\/code>) og <code>LIMIT<\/code>, hvilket resulterer i foresp\u00f8rgsler, der ligner den ovenfor n\u00e6vnte.<\/p>\n<p>Hvorfor? Sagen er, at n\u00e5r du eksplicit angiver identifieren for den sidst l\u00e6ste r\u00e6kke, fort\u00e6ller du din DBMS, hvor den skal begynde at s\u00f8ge efter de n\u00f8dvendige data. Og s\u00f8gningen vil, takket v\u00e6re brugen af n\u00f8glen, blive udf\u00f8rt effektivt, systemet skal ikke forstyrres af r\u00e6kker uden for det angivne interval.<\/p>\n<p>Lad os tage et kig p\u00e5 f\u00f8lgende sammenligning af ydeevnen af forskellige foresp\u00f8rgsler. Her er en ineffektiv foresp\u00f8rgsel.<\/p>\n<p><img decoding=\"async\" alt=\"Det er ikke en god id\u00e9 at bruge OFFSET og LIMIT i foresp\u00f8rgsler med paginering\" src=\"\/wp-content\/uploads\/2020\/08\/11010a30f16e6528272c35d1dee41b76.png\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<i>Langsom foresp\u00f8rgsel<\/i><\/p>\n<p>Og her er en optimeret version af denne foresp\u00f8rgsel.<\/p>\n<p><img decoding=\"async\" alt=\"Det er ikke en god id\u00e9 at bruge OFFSET og LIMIT i foresp\u00f8rgsler med paginering\" src=\"\/wp-content\/uploads\/2020\/08\/6e96525075a3b6b571ef4990e9594299.png\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<i>Hurtig foresp\u00f8rgsel<\/i><\/p>\n<p>Begge foresp\u00f8rgsler returnerer pr\u00e6cist det samme datavolumen. Men den f\u00f8rste tager 12,80 sekunder, mens den anden tager 0,01 sekunder. Kan du m\u00e6rke forskellen?<\/p>\n<h2>Mulige problemer<\/h2>\n<p>\nFor the proposed method of executing queries to work effectively, the table must have a column (or columns) containing unique, sequentially arranged indices, such as an integer identifier. In some specific cases, this can determine the success of such queries aimed at enhancing database performance.<\/p>\n<p>Naturally, when constructing queries, one must consider the characteristics of the table's architecture and choose mechanisms that will perform best with the existing tables. For example, if you need to work with large volumes of related data in queries, you might find this interesting <noindex><a rel=\"nofollow\" href=\"http:\/\/mysql.rjweb.org\/doc.php\/lists\">denne<\/a><\/noindex> article.<\/p>\n<p>If we are faced with the problem of lacking a primary key, for instance, if there is a table with a many-to-many relationship, then the traditional approach involving <code>OFFSET<\/code> og <code>LIMIT<\/code>, will certainly suit us. However, its application may lead to potentially slow queries. In such cases, I would recommend using a primary key with auto-increment, even if it is only needed for organizing paginated query execution.<\/p>\n<p>If you are interested in this topic \u2014 <noindex><a rel=\"nofollow\" href=\"https:\/\/www.sitepoint.com\/mysql-performance-indexes-explain\/\">her<\/a><\/noindex>, <noindex><a rel=\"nofollow\" href=\"https:\/\/www.eversql.com\/mysql-explain-example-explaining-mysql-explain-using-stackoverflow-data\/\">her<\/a><\/noindex> og <noindex><a rel=\"nofollow\" href=\"https:\/\/medium.com\/@tmateus\/elasticsearch-this-is-how-you-should-paginate-your-results-5d1c71bfe060\">her<\/a><\/noindex> \u2014 here are several useful materials.<\/p>\n<h2>Resum\u00e9<\/h2>\n<p>\nThe main conclusion we can draw is that, regardless of the size of the databases in question, it is essential to analyze query execution speed. In our time, the scalability of solutions is extremely important, and if everything is designed correctly from the very beginning of building a system, it can save developers from many headaches in the future.<\/p>\n<p><b>How do you analyze and optimize database queries?<\/b><\/p>\n<p><noindex><a rel=\"nofollow\" href=\"http:\/\/ruvds.com\/ru-rub?utm_source=habr&amp;utm_medium=perevod&amp;utm_campaign=nouseoffsetlimit\"><img decoding=\"async\" alt=\"Det er ikke en god id\u00e9 at bruge OFFSET og LIMIT i foresp\u00f8rgsler med paginering\" src=\"\/wp-content\/uploads\/2020\/08\/690e7d19962e65f14992d3c9cf34ce73.png\" style=\"display:block;margin: 0 auto;\" \/><\/a><\/noindex><br \/>\n<br \/>Kilde: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/513766\/\">habr.com<\/a> <\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u041f\u0440\u043e\u0448\u043b\u0438 \u0442\u0435 \u0434\u043d\u0438, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c\u0441\u044f \u043e\u0431 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412\u0440\u0435\u043c\u044f \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435. \u041a\u0430\u0436\u0434\u044b\u0439 \u043d\u043e\u0432\u044b\u0439 \u0431\u0438\u0437\u043d\u0435\u0441\u043c\u0435\u043d \u0438\u0437 \u0441\u0444\u0435\u0440\u044b \u0432\u044b\u0441\u043e\u043a\u0438\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439 \u0445\u043e\u0447\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 Facebook, \u0441\u0442\u0440\u0435\u043c\u044f\u0441\u044c \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0434\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u0434\u043e\u0442\u044f\u043d\u0443\u0442\u044c\u0441\u044f. \u042d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0443\u0436\u043d\u044b \u0431\u0438\u0437\u043d\u0435\u0441\u0443 \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0437\u0430\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c. \u0412 \u0442\u0430\u043a\u0438\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430\u043c [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":91049,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-91048","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.3 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u041f\u0440\u043e\u0448\u043b\u0438 \u0442\u0435 \u0434\u043d\u0438, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c\u0441\u044f \u043e\u0431 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412\u0440\u0435\u043c\u044f \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/da\/blog\/administrirovanie\/ne-stoit-polzovatsya-offset-i-limit-v-zaprosah-s-razbieniem-na-straniczy\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.3\" \/>\n\t\t<meta property=\"og:locale\" content=\"da_DK\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u041d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f OFFSET \u0438 LIMIT \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u0441 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435\u043c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u041f\u0440\u043e\u0448\u043b\u0438 \u0442\u0435 \u0434\u043d\u0438, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c\u0441\u044f \u043e\u0431 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412\u0440\u0435\u043c\u044f \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/da\/blog\/administrirovanie\/ne-stoit-polzovatsya-offset-i-limit-v-zaprosah-s-razbieniem-na-straniczy\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2020-08-07T23:42:02+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-08-07T23:42:02+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Avoid using OFFSET and LIMIT in paginated queries | ProHoster","description":"Gone are the days when performance optimization of databases was not a concern. Time does not stand still.","canonical_url":"https:\/\/prohoster.info\/da\/blog\/administrirovanie\/ne-stoit-polzovatsya-offset-i-limit-v-zaprosah-s-razbieniem-na-straniczy","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"da_DK","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u041d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f OFFSET \u0438 LIMIT \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u0441 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435\u043c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b | ProHoster","og:description":"\u041f\u0440\u043e\u0448\u043b\u0438 \u0442\u0435 \u0434\u043d\u0438, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c\u0441\u044f \u043e\u0431 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412\u0440\u0435\u043c\u044f \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435.","og:url":"https:\/\/prohoster.info\/da\/blog\/administrirovanie\/ne-stoit-polzovatsya-offset-i-limit-v-zaprosah-s-razbieniem-na-straniczy","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2020-08-07T23:42:02+00:00","article:modified_time":"2020-08-07T23:42:02+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"91048","title":null,"description":null,"keywords":null,"keyphrases":{"focus":[],"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":null,"breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 12:35:24","updated":"2026-08-11 12:50:11","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/da\/wp-json\/wp\/v2\/posts\/91048","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/da\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/da\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/da\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/da\/wp-json\/wp\/v2\/comments?post=91048"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/da\/wp-json\/wp\/v2\/posts\/91048\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/da\/wp-json\/wp\/v2\/media\/91049"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/da\/wp-json\/wp\/v2\/media?parent=91048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/da\/wp-json\/wp\/v2\/categories?post=91048"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/da\/wp-json\/wp\/v2\/tags?post=91048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}