<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Why paging needs a lot of performance</title>
	<atom:link href="http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/feed/" rel="self" type="application/rss+xml" />
	<link>http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/</link>
	<description>it and development at europe's leading clubbing community</description>
	<pubDate>Sun, 06 Jul 2008 23:43:24 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Leo Büttiker</title>
		<link>http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/#comment-4983</link>
		<dc:creator>Leo Büttiker</dc:creator>
		<pubDate>Sun, 13 Apr 2008 11:03:50 +0000</pubDate>
		<guid isPermaLink="false">http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/#comment-4983</guid>
		<description>Well that's true Mark. But it's a question if you realy need this pages then, if they're not vistited by bots they might be also not visited by any humans ('cause usualy they do not found time to click trough 1000 pages)</description>
		<content:encoded><![CDATA[<p>Well that&#8217;s true Mark. But it&#8217;s a question if you realy need this pages then, if they&#8217;re not vistited by bots they might be also not visited by any humans (&#8217;cause usualy they do not found time to click trough 1000 pages)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/#comment-4971</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Mon, 31 Mar 2008 08:19:28 +0000</pubDate>
		<guid isPermaLink="false">http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/#comment-4971</guid>
		<description>You *could* also fiddle with the robots.txt file, to ward off the problems with an over-eager googlebot and his dastardly cousins ;)</description>
		<content:encoded><![CDATA[<p>You *could* also fiddle with the robots.txt file, to ward off the problems with an over-eager googlebot and his dastardly cousins <img src='http://techblog.tilllate.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leo Büttiker</title>
		<link>http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/#comment-4803</link>
		<dc:creator>Leo Büttiker</dc:creator>
		<pubDate>Fri, 25 Jan 2008 07:05:51 +0000</pubDate>
		<guid isPermaLink="false">http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/#comment-4803</guid>
		<description>Doing to many counts is evil, allways! And with no prober caching strategie you run into this very easy, no mather wich db you use. Well MySQL's SQL_CALC_FOUND_ROWS make *erhm* running easier.</description>
		<content:encoded><![CDATA[<p>Doing to many counts is evil, allways! And with no prober caching strategie you run into this very easy, no mather wich db you use. Well MySQL&#8217;s SQL_CALC_FOUND_ROWS make *erhm* running easier.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cms</title>
		<link>http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/#comment-4776</link>
		<dc:creator>cms</dc:creator>
		<pubDate>Tue, 15 Jan 2008 10:31:56 +0000</pubDate>
		<guid isPermaLink="false">http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/#comment-4776</guid>
		<description>You write - count is evil.. it's not true.. yeah, maybe in mysql and funny SQL_CALC_FOUND_ROWS but in postgresql you don't found it ;)</description>
		<content:encoded><![CDATA[<p>You write - count is evil.. it&#8217;s not true.. yeah, maybe in mysql and funny SQL_CALC_FOUND_ROWS but in postgresql you don&#8217;t found it <img src='http://techblog.tilllate.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leo Büttiker</title>
		<link>http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/#comment-4774</link>
		<dc:creator>Leo Büttiker</dc:creator>
		<pubDate>Mon, 14 Jan 2008 15:11:41 +0000</pubDate>
		<guid isPermaLink="false">http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/#comment-4774</guid>
		<description>@Quinton: ORDER BY/GROUP BY with LIMIT is slow because it can't take profit from the LIMIT offset.
@Freddy: Thanks I get it now. I have to try it out.
@Bertrand: Yes, querying a database is slow! The point of this article is that ORDER BY/GROUP BY with LIMIT my causes very slow queries. You see this faster in queries with fulltextsearch, but it's the same for fields with indexes, but not in that dramatic way. As long as you have no problems with doing paging, great! But when you run into performance issues you probably have to rethink how unusable my tips are.</description>
		<content:encoded><![CDATA[<p>@Quinton: ORDER BY/GROUP BY with LIMIT is slow because it can&#8217;t take profit from the LIMIT offset.<br />
@Freddy: Thanks I get it now. I have to try it out.<br />
@Bertrand: Yes, querying a database is slow! The point of this article is that ORDER BY/GROUP BY with LIMIT my causes very slow queries. You see this faster in queries with fulltextsearch, but it&#8217;s the same for fields with indexes, but not in that dramatic way. As long as you have no problems with doing paging, great! But when you run into performance issues you probably have to rethink how unusable my tips are.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bertrand Mansion</title>
		<link>http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/#comment-4771</link>
		<dc:creator>Bertrand Mansion</dc:creator>
		<pubDate>Mon, 14 Jan 2008 08:02:44 +0000</pubDate>
		<guid isPermaLink="false">http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/#comment-4771</guid>
		<description>Sure. And using a database will cost some performance as well...

Optimization has to be done on the database level, some databases are better than others in this regard. I don't buy your arguments. Obviously you are mixing problems related to your fulltext search with problems related to paging, ordering and indexes. And the solutions you provide are all but usable in real web applications.

In the end, I wonder what is the point of this article. Querying a database is slow?</description>
		<content:encoded><![CDATA[<p>Sure. And using a database will cost some performance as well&#8230;</p>
<p>Optimization has to be done on the database level, some databases are better than others in this regard. I don&#8217;t buy your arguments. Obviously you are mixing problems related to your fulltext search with problems related to paging, ordering and indexes. And the solutions you provide are all but usable in real web applications.</p>
<p>In the end, I wonder what is the point of this article. Querying a database is slow?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Freddy</title>
		<link>http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/#comment-4763</link>
		<dc:creator>Freddy</dc:creator>
		<pubDate>Thu, 10 Jan 2008 19:25:27 +0000</pubDate>
		<guid isPermaLink="false">http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/#comment-4763</guid>
		<description>I presume gb.id is the unique ID for every gb-entry.
If you do "SELECT gb.*, [...] WHERE gb.uid_to='22152'
AND visible='1' LIMIT 0,10;" for page 1 you might probably do something like "SELECT gb.*, [...] WHERE gb.uid_to='22152'
AND visible='1' LIMIT 2000,10;" or "[...] LIMIT 10 OFFSET 2000" für page 200 which performs VERY bad in MYSQL (especially if you use ORDER BY gb.id which you should to assure the right order).
Its much faster to do a "SELECT gb.id FROM [] ORDER BY gb.id DESC LIMIT 2000,1" first (if and only if there is a key on "id") and do "SELECT gb.*, [...] WHERE [...] AND id &#60; [value from query 1] ORDER BY id DESC LIMIT 10;". Query 1 only uses the index and is very very fast. Query 2 is the expensiv one doesn't care anymore about the gb-entrys from the first 200 pages (because their ID is higher).

I hope its more clear now.</description>
		<content:encoded><![CDATA[<p>I presume gb.id is the unique ID for every gb-entry.<br />
If you do &#8220;SELECT gb.*, [...] WHERE gb.uid_to=&#8217;22152&#8242;<br />
AND visible=&#8217;1&#8242; LIMIT 0,10;&#8221; for page 1 you might probably do something like &#8220;SELECT gb.*, [...] WHERE gb.uid_to=&#8217;22152&#8242;<br />
AND visible=&#8217;1&#8242; LIMIT 2000,10;&#8221; or &#8220;[...] LIMIT 10 OFFSET 2000&#8243; für page 200 which performs VERY bad in MYSQL (especially if you use ORDER BY gb.id which you should to assure the right order).<br />
Its much faster to do a &#8220;SELECT gb.id FROM [] ORDER BY gb.id DESC LIMIT 2000,1&#8243; first (if and only if there is a key on &#8220;id&#8221;) and do &#8220;SELECT gb.*, [...] WHERE [...] AND id &lt; [value from query 1] ORDER BY id DESC LIMIT 10;&#8221;. Query 1 only uses the index and is very very fast. Query 2 is the expensiv one doesn&#8217;t care anymore about the gb-entrys from the first 200 pages (because their ID is higher).</p>
<p>I hope its more clear now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pourquoi la pagination coûte autant de performances</title>
		<link>http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/#comment-4758</link>
		<dc:creator>Pourquoi la pagination coûte autant de performances</dc:creator>
		<pubDate>Thu, 10 Jan 2008 09:35:09 +0000</pubDate>
		<guid isPermaLink="false">http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/#comment-4758</guid>
		<description>[...] &#160;Why paging needs a lot of performance (0 visite) [...]</description>
		<content:encoded><![CDATA[<p>[...] &nbsp;Why paging needs a lot of performance (0 visite) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Quinton</title>
		<link>http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/#comment-4741</link>
		<dc:creator>Quinton</dc:creator>
		<pubDate>Tue, 08 Jan 2008 18:32:50 +0000</pubDate>
		<guid isPermaLink="false">http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/#comment-4741</guid>
		<description>I've just recently experienced this very issue. 

SQL_CALC_FOUND_ROWS is going to be problematic when paginating large datasets. Reason being MySQL is required to evaluate all the rows in the table even though you may limit results returned to say 10. See the mysqlperformanceblog.

In this case I agree use COUNT(*) as separate query for determining the total no. of rows matched by a LIMITed query. At least on subsequent pages the query which performs the COUNT(*) can be query-cached.

But you havent figured out the real reason why ORDER BY/GROUP BY clauses affect performance so severly.

You need compound indexes. If you really really dont need an ORDER BY use ORDER BY NULL to negate the implicit ORDER BY created when performing a GROUP BY</description>
		<content:encoded><![CDATA[<p>I&#8217;ve just recently experienced this very issue. </p>
<p>SQL_CALC_FOUND_ROWS is going to be problematic when paginating large datasets. Reason being MySQL is required to evaluate all the rows in the table even though you may limit results returned to say 10. See the mysqlperformanceblog.</p>
<p>In this case I agree use COUNT(*) as separate query for determining the total no. of rows matched by a LIMITed query. At least on subsequent pages the query which performs the COUNT(*) can be query-cached.</p>
<p>But you havent figured out the real reason why ORDER BY/GROUP BY clauses affect performance so severly.</p>
<p>You need compound indexes. If you really really dont need an ORDER BY use ORDER BY NULL to negate the implicit ORDER BY created when performing a GROUP BY</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leo Büttiker</title>
		<link>http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/#comment-4733</link>
		<dc:creator>Leo Büttiker</dc:creator>
		<pubDate>Tue, 08 Jan 2008 07:17:32 +0000</pubDate>
		<guid isPermaLink="false">http://techblog.tilllate.com/2008/01/05/why-paging-needs-a-lot-of-performance/#comment-4733</guid>
		<description>@Trophaeum: Cool idea!
@Freddy: Yes, indexes are very helpfull. Specialy when you can use them for the order as well. Sometimes deterministic is not so important, think about search results or lists that are mainly for googlebot indexing. I'm not 100 percent sure what you want to do with spliting queries, "ORDER BY id" and LIMIT will only work on very simple queries (and unfortunatly we don't have anymore simple queries ;-)</description>
		<content:encoded><![CDATA[<p>@Trophaeum: Cool idea!<br />
@Freddy: Yes, indexes are very helpfull. Specialy when you can use them for the order as well. Sometimes deterministic is not so important, think about search results or lists that are mainly for googlebot indexing. I&#8217;m not 100 percent sure what you want to do with spliting queries, &#8220;ORDER BY id&#8221; and LIMIT will only work on very simple queries (and unfortunatly we don&#8217;t have anymore simple queries <img src='http://techblog.tilllate.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
</channel>
</rss>
