From: Johan De Meersman Date: February 9 2012 11:40am Subject: Re: C api mysql_store_result vs mysql_use_result List-Archive: http://lists.mysql.com/mysql/226761 Message-Id: <59bb2ba7-1d8f-4111-812d-7ab3a21228cf@zimbra> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit ----- Original Message ----- > From: "Alex Schaft" > > If I were to do a select count(*) from x where y prior to doing > select * from x where y to get a number of records, how would this impact > performance on the server itself? Would the first query be the one to > do the most processing, with the second one being faster, or would both > have to do the same amount of work? Heh. The amount of work put into parsing and executing would be the same, except if you can compose your count query to use only indexed fields. Easily checked with an explain of both queries, I'd say. Also, do consider if you really need a %complete progress indicator, or if a simple record counter with no indicated endpoint will do. That is, do your users need to know how long it's going to take, or do they just want assurance that the process didn't hang? -- Bier met grenadyn Is als mosterd by den wyn Sy die't drinkt, is eene kwezel Hy die't drinkt, is ras een ezel