> In the last episode (Sep 17), Miguel Cardenas said:
> > I have a technical doubt, very simple but not mentioned in the manual...
> >
> > What happens if I call mysql_free_result() after performing a query
> > but without doing mysql_fetch_row() ???
> >
> > It may sound strange, but just need to know if a data row exists more
> > than the data itself...
>
> A faster way would be to run a "SELECT count(*) WHERE ..." query, and
> check the result.  Since you are not selecting any data, mysql is more
> likely to be able to use index lookups to speed the query up.

Well, in fact don't want to check if there is data already inserted on the 
table to make condition TRUE, what I want is to do this:

SELECT id,data FROM table WHERE id=XXX

but, just want to check if it the search found something and then free the 
resources, not to retrieve the data... in short words:

1. search rows which id=XXX
2. if mysql_num_rows() > 0 then CONDITION=TRUE else CONDITION=FALSE
3. mysql_free_result()

WHY? well, this operation will be repeated over 100,000 times and only need to 
know if the specified data exists, the difference between just know and 
retrieve 1 time and 100,000 times surely would be significative if I try

1. search rows which id=XXX
2. if mysql_fetch_row() then CONDITION=TRUE else CONDITION=FALSE
3. mysql_free_result()

Specifically, my doubt is, what happen if I call mysql_free_result() if I 
don't call mysql_fetch_row() before, or if not all rows are read before 
calling it...

Regards


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to