{"id":247319,"date":"2024-01-02T20:21:20","date_gmt":"2024-01-02T12:21:20","guid":{"rendered":"https:\/\/www.idc.net\/help\/247319\/"},"modified":"2024-01-02T20:21:20","modified_gmt":"2024-01-02T12:21:20","slug":"%e5%a6%82%e4%bd%95%e4%bf%ae%e5%a4%8dpostgresql%e9%94%99%e8%af%af%e4%bb%a3%e7%a0%81%ef%bc%9ap0003-too_many_rows%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/247319\/","title":{"rendered":"\u5982\u4f55\u4fee\u590dPostgreSQL\u9519\u8bef\u4ee3\u7801\uff1aP0003 &#8211; too_many_rows\uff1f"},"content":{"rendered":"<p><title id=\"%e5%a6%82%e4%bd%95%e4%bf%ae%e5%a4%8dpostgresql%e9%94%99%e8%af%af%e4%bb%a3%e7%a0%81%ef%bc%9ap0003-too_many_rows%ef%bc%9f-TByZKtULRI\">\u5982\u4f55\u4fee\u590dPostgreSQL\u9519\u8bef\u4ee3\u7801\uff1aP0003 - too_many_rows\uff1f<\/title><\/p>\n<h1 id=\"%e5%a6%82%e4%bd%95%e4%bf%ae%e5%a4%8dpostgresql%e9%94%99%e8%af%af%e4%bb%a3%e7%a0%81%ef%bc%9ap0003-too_many_rows%ef%bc%9f-TByZKtULRI\">\u5982\u4f55\u4fee\u590dPostgreSQL\u9519\u8bef\u4ee3\u7801\uff1aP0003 - too_many_rows\uff1f<\/h1>\n<p>PostgreSQL\u662f\u4e00\u79cd\u529f\u80fd\u5f3a\u5927\u7684\u5f00\u6e90\u5173\u7cfb\u578b\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\uff0c\u5e7f\u6cdb\u5e94\u7528\u4e8e\u5404\u79cd\u5e94\u7528\u7a0b\u5e8f\u548c\u7f51\u7ad9\u3002\u7136\u800c\uff0c\u6709\u65f6\u5019\u5728\u4f7f\u7528PostgreSQL\u65f6\uff0c\u60a8\u53ef\u80fd\u4f1a\u9047\u5230\u9519\u8bef\u4ee3\u7801P0003 - too_many_rows\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u8fd9\u4e2a\u9519\u8bef\u7684\u539f\u56e0\u4ee5\u53ca\u5982\u4f55\u4fee\u590d\u5b83\u3002<\/p>\n<h2 id=\"%e9%94%99%e8%af%af%e5%8e%9f%e5%9b%a0-TByZKtULRI\">\u9519\u8bef\u539f\u56e0<\/h2>\n<p>\u9519\u8bef\u4ee3\u7801P0003\u8868\u793a\u67e5\u8be2\u8fd4\u56de\u4e86\u592a\u591a\u7684\u884c\u3002\u8fd9\u901a\u5e38\u53d1\u751f\u5728\u4f7f\u7528\u5355\u884c\u67e5\u8be2\u65f6\uff0c\u4f46\u67e5\u8be2\u8fd4\u56de\u4e86\u591a\u884c\u7ed3\u679c\u3002\u4f8b\u5982\uff0c\u5982\u679c\u60a8\u4f7f\u7528\u4e86\u4e00\u4e2a\u671f\u671b\u53ea\u8fd4\u56de\u4e00\u4e2a\u7ed3\u679c\u7684SELECT\u8bed\u53e5\uff0c\u4f46\u5b9e\u9645\u4e0a\u8fd4\u56de\u4e86\u591a\u4e2a\u7ed3\u679c\uff0c\u5c31\u4f1a\u89e6\u53d1\u8fd9\u4e2a\u9519\u8bef\u3002<\/p>\n<h2 id=\"%e4%bf%ae%e5%a4%8d%e6%96%b9%e6%b3%95-TByZKtULRI\">\u4fee\u590d\u65b9\u6cd5<\/h2>\n<p>\u4fee\u590dP0003\u9519\u8bef\u7684\u65b9\u6cd5\u53d6\u51b3\u4e8e\u60a8\u7684\u5177\u4f53\u60c5\u51b5\u548c\u67e5\u8be2\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684\u4fee\u590d\u65b9\u6cd5\uff1a<\/p>\n<h3 id=\"1-%e4%bd%bf%e7%94%a8limit%e5%ad%90%e5%8f%a5-TByZKtULRI\">1. \u4f7f\u7528LIMIT\u5b50\u53e5<\/h3>\n<p>\u5982\u679c\u60a8\u671f\u671b\u67e5\u8be2\u53ea\u8fd4\u56de\u4e00\u4e2a\u7ed3\u679c\uff0c\u53ef\u4ee5\u4f7f\u7528LIMIT\u5b50\u53e5\u6765\u9650\u5236\u7ed3\u679c\u96c6\u7684\u5927\u5c0f\u3002\u4f8b\u5982\uff0c\u5c06SELECT\u8bed\u53e5\u4fee\u6539\u4e3a\uff1a<\/p>\n<pre><code>SELECT column1, column2 FROM table_name LIMIT 1;<\/code><\/pre>\n<p>\u8fd9\u5c06\u53ea\u8fd4\u56de\u7ed3\u679c\u96c6\u4e2d\u7684\u7b2c\u4e00\u884c\u3002<\/p>\n<h3 id=\"2-%e4%bd%bf%e7%94%a8where%e5%ad%90%e5%8f%a5-TByZKtULRI\">2. \u4f7f\u7528WHERE\u5b50\u53e5<\/h3>\n<p>\u5982\u679c\u60a8\u671f\u671b\u67e5\u8be2\u53ea\u8fd4\u56de\u6ee1\u8db3\u7279\u5b9a\u6761\u4ef6\u7684\u7ed3\u679c\uff0c\u53ef\u4ee5\u4f7f\u7528WHERE\u5b50\u53e5\u6765\u8fc7\u6ee4\u7ed3\u679c\u96c6\u3002\u4f8b\u5982\uff0c\u5c06SELECT\u8bed\u53e5\u4fee\u6539\u4e3a\uff1a<\/p>\n<pre><code>SELECT column1, column2 FROM table_name WHERE condition;<\/code><\/pre>\n<p>\u5176\u4e2dcondition\u662f\u60a8\u5e0c\u671b\u6ee1\u8db3\u7684\u6761\u4ef6\u3002\u8fd9\u5c06\u53ea\u8fd4\u56de\u6ee1\u8db3\u6761\u4ef6\u7684\u884c\u3002<\/p>\n<h3 id=\"3-%e4%bd%bf%e7%94%a8%e5%ad%90%e6%9f%a5%e8%af%a2-TByZKtULRI\">3. \u4f7f\u7528\u5b50\u67e5\u8be2<\/h3>\n<p>\u5982\u679c\u60a8\u9700\u8981\u4ece\u591a\u4e2a\u8868\u4e2d\u68c0\u7d22\u6570\u636e\uff0c\u5e76\u4e14\u53ea\u671f\u671b\u8fd4\u56de\u4e00\u4e2a\u7ed3\u679c\uff0c\u53ef\u4ee5\u4f7f\u7528\u5b50\u67e5\u8be2\u6765\u9650\u5236\u7ed3\u679c\u96c6\u7684\u5927\u5c0f\u3002\u4f8b\u5982\uff0c\u5c06SELECT\u8bed\u53e5\u4fee\u6539\u4e3a\uff1a<\/p>\n<pre><code>SELECT column1, column2 FROM (SELECT column1, column2 FROM table_name1 INNER JOIN table_name2 ON condition) AS subquery LIMIT 1;<\/code><\/pre>\n<p>\u8fd9\u5c06\u8fd4\u56de\u5b50\u67e5\u8be2\u4e2d\u7684\u7b2c\u4e00\u884c\u7ed3\u679c\u3002<\/p>\n<h2 id=\"%e6%80%bb%e7%bb%93-TByZKtULRI\">\u603b\u7ed3<\/h2>\n<p>\u5728\u4f7f\u7528PostgreSQL\u65f6\uff0c\u9519\u8bef\u4ee3\u7801P0003 - too_many_rows\u53ef\u80fd\u4f1a\u51fa\u73b0\uff0c\u8868\u793a\u67e5\u8be2\u8fd4\u56de\u4e86\u592a\u591a\u7684\u884c\u3002\u4e3a\u4e86\u4fee\u590d\u8fd9\u4e2a\u9519\u8bef\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528LIMIT\u5b50\u53e5\u6765\u9650\u5236\u7ed3\u679c\u96c6\u7684\u5927\u5c0f\uff0c\u4f7f\u7528WHERE\u5b50\u53e5\u6765\u8fc7\u6ee4\u7ed3\u679c\u96c6\uff0c\u6216\u8005\u4f7f\u7528\u5b50\u67e5\u8be2\u6765\u9650\u5236\u7ed3\u679c\u96c6\u7684\u5927\u5c0f\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u5bfb\u627e\u53ef\u9760\u7684\u9999\u6e2f\u670d\u52a1\u5668\uff0c\u540e\u6d6a\u4e91\u662f\u60a8\u7684\u9996\u9009\u3002\u6211\u4eec\u63d0\u4f9b\u9ad8\u6027\u80fd\u7684\u9999\u6e2f\u670d\u52a1\u5668\uff0c\u786e\u4fdd\u60a8\u7684\u7f51\u7ad9\u548c\u5e94\u7528\u7a0b\u5e8f\u59cb\u7ec8\u4fdd\u6301\u7a33\u5b9a\u548c\u53ef\u9760\u3002\u70b9\u51fb<a href=\"https:\/\/idc.net\">\u8fd9\u91cc<\/a>\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4fee\u590dPostgreSQL\u9519\u8bef\u4ee3\u7801\uff1aP0003 - too_many_rows\uff1f \u5982\u4f55\u4fee\u590dPostgreSQ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7038],"tags":[],"class_list":["post-247319","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/247319","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=247319"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/247319\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=247319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=247319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=247319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}