Selecting just 'N' first rows
Hello How can I send a query that retrieves only the first 'N' rows that match a condition? As far as I know you must call mysql_fetch_row() until the last row has been processed or the resources allocated won't be free. Am creating a program in PHP that should retrieve only 'N' records each time a query is sent, so I I'm thinking on using mysql_free_result(), but, is it safe to free the results even if there are more records remaining that match the query conditions? I need to know how secure could be to read only the first records and free the resources, or if there is another way to do the same thing. Thanks, Miguel -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Selecting just 'N' first rows
Look up the LIMIT clause of SELECT statement, also ASCENDING/DESCENDING - depending on how you want it. Remember LIMIT can take a number and an offset. Terry - Original Message - *From:* Renito 73 [EMAIL PROTECTED] *To:* mysql@lists.mysql.com *Date:* Sun, 9 Sep 2007 10:05:52 -0500 Hello How can I send a query that retrieves only the first 'N' rows that match a condition? As far as I know you must call mysql_fetch_row() until the last row has been processed or the resources allocated won't be free. Am creating a program in PHP that should retrieve only 'N' records each time a query is sent, so I I'm thinking on using mysql_free_result(), but, is it safe to free the results even if there are more records remaining that match the query conditions? I need to know how secure could be to read only the first records and free the resources, or if there is another way to do the same thing. Thanks, Miguel -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG. Version: 7.5.485 / Virus Database: 269.13.10/995 - Release Date: 08/09/2007 13:24 Terry http://booksihaveread.awardspace.co.uk -- No virus found in this outgoing message. Checked by AVG. Version: 7.5.485 / Virus Database: 269.13.10/995 - Release Date: 08/09/2007 13:24 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Selecting just 'N' first rows
How can I send a query that retrieves only the first 'N' rows that match a condition? As far as I know you must call mysql_fetch_row() until the last row has been processed or the resources allocated won't be free. Am creating a program in PHP that should retrieve only 'N' records each time a query is sent, so I I'm thinking on using mysql_free_result(), but, is it safe to free the results even if there are more records remaining that match the query conditions? I need to know how secure could be to read only the first records and free the resources, or if there is another way to do the same thing. Why dont' you just use the LIMIT statement? thnx, Chris -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: MySQL 6.0.2-alpha and Falcon and possible bug/problem
Mathieu Bruneau wrote: I never tried the falcon engine, but could it be that mysql is running out of file descriptor ? That's less likely with Falcon than with engines that put each table and index in its own file. By default, Falcon tables share a single tablespace. Regards, Ann -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: MySQL 6.0.2-alpha and Falcon and possible bug/problem
Mariella Petrini wrote: ...MySQL 6.0.2 with Falcon on Linux with Debian 4. I have compiled the source code for 64 bit executable. The system is an Intel 2 cpus 4 cores each, with 8 GB of RAM. After having created approximately 8,500 empty tables mysqld server was still alive, you could connect with the mysql client, but any command that you would type would freeze (never come back). It would be interesting to get a stack trace at that point. We do have tests that create that many tables, so the problem is going to take some thought. I will try to re-run the same job, enabling falcon_debug_mask and see if I can get more info and repeat the problem. Sounds good - that can produce a LOT of output... so be sure to redirect it to a file. Best regards, Ann -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]