473,387 Members | 1,374 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

db-queries

Hello,

some little questions relating LAMP (PHP 4.3.4, MySQL 3.x, Apache):
I'm trying to build a community website which needs many db-querys for lots
of concurrent users.
Therefore I'm always using:
$ergebnis = mysql_query ($sql) or die (mysql_error());
while ($row = mysql_fetch_array($ergebnis))
{
$myvar = $row['column_xy'];
}

Is there a limit for db-connections under MySQL3.x?
What happens if hundreds of users are accessing these pages simultaneously?
I heard MySQL breaks down if there are more than 200 users!?

Is there a better/more efficient way for the db-queries under PHP4?
How efficient would it be to write all possible db-results into
session-variables in order to keep the number of queries low?
What about performance using many session-variables?

Thank you very much in anticipation!
Bernd


Jul 17 '05 #1
2 1309
Bernd,
some little questions relating LAMP (PHP 4.3.4, MySQL 3.x, Apache):
I'm trying to build a community website which needs many db-querys for lots
of concurrent users.
Therefore I'm always using:
$ergebnis = mysql_query ($sql) or die (mysql_error());
while ($row = mysql_fetch_array($ergebnis))
{
$myvar = $row['column_xy'];
}

Is there a limit for db-connections under MySQL3.x?
What happens if hundreds of users are accessing these pages simultaneously?
I heard MySQL breaks down if there are more than 200 users!?


First off 3.x is not the MySQL installation you should be using. 4.0 or
4.1 you should be using now. Also your PHP installation is dated where
PHP is at version 4.3.11.

Now as for users, I have never had MySQL break down. I also have 50
websites that run off of one database with one administration panel.
These sites get fairly heavy traffic.

Now what you should pretty much do is Cache your queries so you are not
always querying the database. Only query when you need to. Make use of
JOIN statements, so you are not constantly querying for data that could
be in one query. Sometimes these JOINs can get a bit messy because some
of them are INNER JOINS some are LEFT OUTER JOINS etc.. And you end up
with a paragraph long query. But simply, it runs much faster.

Make sure you have index's on certain id's and things you will be
looking up regularly such as usernames and passwords, this allows you to
do an index query. These are normally very quick.

Also as for the connection limit on MySQL you can change the threshold
on that in the config file. Also you might want to think about reusing
your connection PConnect. For me this works much better, but for some
they experience problems.

Mike
Jul 17 '05 #2
Thanx!!
But what do you mean by caching the queries?
I'm already using many JOINs to keep the number of queries as low as
possible.
What do you think about the session-variables? Can they be handled quick
enough or will they slow down the server?

First off 3.x is not the MySQL installation you should be using. 4.0 or
4.1 you should be using now. Also your PHP installation is dated where
PHP is at version 4.3.11.

Now as for users, I have never had MySQL break down. I also have 50
websites that run off of one database with one administration panel. These
sites get fairly heavy traffic.

Now what you should pretty much do is Cache your queries so you are not
always querying the database. Only query when you need to. Make use of
JOIN statements, so you are not constantly querying for data that could be
in one query. Sometimes these JOINs can get a bit messy because some of
them are INNER JOINS some are LEFT OUTER JOINS etc.. And you end up with a
paragraph long query. But simply, it runs much faster.

Make sure you have index's on certain id's and things you will be looking
up regularly such as usernames and passwords, this allows you to do an
index query. These are normally very quick.

Also as for the connection limit on MySQL you can change the threshold on
that in the config file. Also you might want to think about reusing your
connection PConnect. For me this works much better, but for some they
experience problems.

Mike

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Sven Jacobs | last post by:
Dear newsgroup, I've upgraded to PEAR::DB 1.6.5 recently. Unfortunately now the database connection doesn't work as expected anymore :( The problems seems to be the method disconnect(), which...
2
by: Oliver Peek | last post by:
Hi all, Probably my fault, I'm opening a Berkeley DB file, iterating through and deleting keys, well making an attempt. I get this error when I try to delete. ---error Traceback (most...
7
by: martijn | last post by:
WHen I use the code below and printing all the results i get this: ------ 0 1 10 11 2 3 4 5 6 7 8 9 ------ But I want ------ 0 1 2
0
by: barbara | last post by:
I am using this procedure from net for getting the restore script. It lists the latest full backup file name and logs after that point. Is there any way to modify this script to take either date...
5
by: lwoods | last post by:
When I execute the following script I can connect using 'mysqli_connect' but I get a "DB Error: Not Found" when I display the $db->Message() after attempting the DB::Connect. And, "yes", the...
5
by: Ale | last post by:
Ciao a tutti. Ho eliminato il database di esempio SAMPLE(non cancellato). Ora lo voglio reinstallare ma durante l'installazione mi da il seguente errore: nella finestra con scritto SQL1005N c'è...
22
by: Smutny30 | last post by:
Hello, I am preparing a database that will store 10 n * GBs - 100 n * GBs of data. I calculated to have 1,2 GB of bufferpools. I run the DB2 v. 8.2.1 alone on 4 GB box. I obtain : ...
2
by: Sam Shaw | last post by:
I have been looking after an MS Access database, using table links to access data in a back-end MDB database. We have recently micrated to a SQL Server 2000 back-end atabase, once again accessing...
2
by: daralthus | last post by:
Hello! I would like to ask your help, i have founded a great code here: http://www.jamescaws.co.uk/2008/07/dynamically-count-exit-link-clicks-throughs-using-javascript-php/ but it uses Pear DB...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...

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.