473,480 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how does mysql_fetch_*() work?

Dormilich
8,658 Recognized Expert Moderator Expert
Hi guys,

reading a recent thread, I wonder if the mysql_fetch_*() functions make a DB connection every time they are called. has anybody some in-depth knowledge or can point me to a resource (google lists all the various manual entries for a long time, if I search)?

Thanks
Jan 12 '10 #1
3 2619
dgreenhouse
250 Recognized Expert Contributor
It's my understanding that the _fetch_ commands just return an array of the most recently requested values from the active or requested connection and moves the file pointer on the underlying database.

The best way to know for sure is to look inside of the driver implementation at the "C/C++" level, which I'm putting on the burner for my own curiosity.

I'd think it would be very, very, inefficient and expensive to make connections every time a fetch is invoked, so I'd have to say no.
Jan 13 '10 #2
Atli
5,058 Recognized Expert Expert
I seem to recall reading - although I can't remember the source - that PHP buffers the entire result set of the mysql_query call in memory, from which the mysql_fetch_*, and other mysql functions, access it.

The description of the mysql_unbuffered_query function supports that:
mysql_unbuffered_query() sends the SQL query query to MySQL without automatically fetching and buffering the result rows as mysql_query() does. This saves a considerable amount of memory with SQL queries that produce large result sets, and you can start working on the result set immediately ...
Jan 13 '10 #3
dgreenhouse
250 Recognized Expert Contributor
This is a really good thread...

Now I'm really confused... :-)

I've been Googling a bit and it seems as though the memory constraints are on MySQL and not necessarily PHP. As you may notice, you can select some very large result sets with PHP and most PHP configurations are setup with fairly low memory. So... my thinking is that the memory under question is the memory that MySQL consumes not PHP. I know I can cause a timeout in PHP by requesting a large result set and I assume that's because PHP is waiting on MySQL to complete.

Googles I've tried so far:
1- mysql out of memory error
2- mysql_query out of memory error
3- Others...

Also, this seems to put some light on the subject:
http://www.php.net/manual/en/languag...s.resource.php

Thanks for the great brain-teaser!

Be nice if someone who's delved-deep pipes in...

I'll look into the driver source code and see if I can get a definitive answer.
Jan 13 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
4833
by: Jonas | last post by:
This works fine in Win XP but does not work at all in Win 98. Private WithEvents objIExplorer As InternetExplorer I have to do it like this to get it to work in Win 98 Dim objIExplorer As...
5
3592
by: me | last post by:
I have a Class Library that contains a Form and several helper classes. A thread gets created that performs processing of data behind the scenes and the Form never gets displayed (it is for debug...
22
2563
by: Robert Bralic | last post by:
CAN anybody tell me any address where I can download some small(1000-2000) lines C++ proghram source. Or send me ,a small(1000-2000) lines C++ program source that I can compille with gpp under...
12
2912
by: Frank Hauptlorenz | last post by:
Hello Out there! I have a DB2 V7.2 Database (Fix11) on Win 2000 Professional. It was before a NT 4 based Domain - now it is a Win 2000 Domain. The database server is a domain member. Now...
0
2341
by: Jarod_24 | last post by:
How does tabindex work in ASP .net pages I dosen't seem to work quite like in regular forms. and there isn't any TabStop property either. 1 .How do you prevent a control form beign "tabbed"....
14
4811
by: Anoop | last post by:
Hi, I am new to this newsgroup and need help in the following questions. 1. I am workin' on a GUI application. Does C# provides Layout Managers the way Java does to design GUI? I know that it...
89
5944
by: Cuthbert | last post by:
After compiling the source code with gcc v.4.1.1, I got a warning message: "/tmp/ccixzSIL.o: In function 'main';ex.c: (.text+0x9a): warning: the 'gets' function is dangerous and should not be...
14
3449
by: webEater | last post by:
I have a problem, it's not browser specific, and I don't get a solution. I have an (X)HTML document, I show you a part of it: .... <!--<div class="pad">--> <div id="eventImages"><img src=""...
1
7075
by: =?ISO-8859-1?Q?Lasse_V=E5gs=E6ther_Karlsen?= | last post by:
I get the above error in some of the ASP.NET web applications on a server, and I need some help figuring out how to deal with it. This is a rather long post, and I hope I have enough details that...
0
7048
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6741
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6956
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5342
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4783
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
2997
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2986
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.