search
HomeBackend DevelopmentPHP TutorialComparison of performance of connecting mysql and oracle databases using PHP_PHP tutorial

Comparison of performance of connecting mysql and oracle databases using PHP_PHP tutorial

Jul 21, 2016 pm 04:07 PM
mysqloraclephpandperformancedatabaseyesComparetestuseusehardwareillustrateConfiguration

Test hardware description:
The test uses my favorite machine, the configuration is as follows:
CPU: C433
Memory: 128M
Hard drive: Barracuda 2nd generation 20G

Test software description :
Windows nt server4, sp5, apache 1.3.12, php3.0.15 and php4rc1, mysql 3.22.29, oracle 8.0.5 are used under WIN32.
Bluepoint linux1.0, apache 1.3 is used under linux. .12, php4rc1, mysql 3.22.32

Test code description:
Use a very simple table. The table structure used by mysql and oracle is the same, with only three fields. The structure is as follows:
MySQL table structure:
CREATE TABLE board (
board_id smallint(6) NOT NULL auto_increment,
board_name char(16) NOT NULL,
board_manager char(20),
PRIMARY KEY (board_id)
);
Oracle structure:
CREATE TABLE PHP_ORACLE."BOARD"
("BOARD_ID" FLOAT,
"BOARD_NAME" CHAR(16) NOT NULL,
"BOARD_MANAGER" CHAR(20)) ;

We only tested the time spent on the INSERT operation, and did not test the select.
Because only PHP3 can connect to the Oracle database under win32, we only tested the performance of using PHP3 to connect to Oracle. I believe that after the official version of PHP4 comes out, the speed of using PHP4 to connect to Oracle should be improved.
Under LINUX, because I did not install Oracle, I only tested the performance of mysql. It is said that under LINUX, Oracle's performance is good, but it cannot be tested.
And we put all the code used for database connection and Oracle to analyze SQL statements outside the statistical code, so the time measured in the test is only the time spent executing SQL operations.

Program used to test mysql:

$dblink=mysql_connect("localhost","root","shh123");
mysql_select_db(" bbs");
$counter=1;
set_time_limit(300);
$query="insert into board (board_name,board_manager) values ​​('test','test')";
$begin_time=time();
for ($i=1;$i mysql_db_query("bbs",$query);
$counter++;
}
$end_time=time();
mysql_close($dblink);
echo "test db speed...
";
echo "begin time:".$begin_time."
";
echo "
end time:".$end_time."
";
$total=$end_time-$begin_time;
echo "total spent time :".$total;
?>

Program used to test oracle:

$handle=OCILogon("php_oracle","php_oracle" );

$counter=1;
set_time_limit(300);
$query="insert into board (board_id,board_name,board_manager) values ​​(:board_id,'test','test' )";
$state=OCIParse($handle, $query);
OCIBindByName($state, ":board_id", &$i,32);
$begin_time=time();
for ($i=1;$i ociexecute($state);
}
$end_time=time();
OCIFreeStatement($state);
ocilogoff($handle);
echo "test db speed...
";
echo "begin time:".$begin_time."
";
echo "
end time:".$end_time."
";
$total=$end_time-$begin_time;
echo "total spent time:".$total;
? >

Test result:

Environment: win32+apache+php4+mysql
Result: 28 seconds

Environment: win32+apache+php3+mysql
Result: 34 seconds

Environment: win32+apache+php3+oracle8.0.5 (oci function)
Result: 46 seconds

Environment: linux+apache+php4+mysql
Result: 10 seconds

Conclusion:
Under WIN32, although the performance of mysql is not very good, it is still much faster than oracle8, especially in the test program, I did not The database connection statements are included, so this test result is only the time it takes to insert data, and Oracle's connection, my God, is too slow! On my machine, it takes at least 1-2 seconds to connect once. Under LINUX, the performance of mysql has made a big leap compared to that under WIN32. Sharply reduced from 28 seconds to 10 seconds. Therefore, if you do not need the support of stored procedures, and the database size is not so large, it is better to use mysql as your database under LINUX! This lightweight database gives you the best performance, manageability, and pretty good security.​

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/315105.htmlTechArticleTest hardware description: The test uses my favorite machine, the configuration is as follows: CPU: C433 Memory: 128M Hard drive: Baruyu 2nd generation 20G test software description: Windows nt server4, sp5,...
are used under WIN32
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What is the difference between absolute and idle session timeouts?What is the difference between absolute and idle session timeouts?May 03, 2025 am 12:21 AM

Absolute session timeout starts at the time of session creation, while an idle session timeout starts at the time of user's no operation. Absolute session timeout is suitable for scenarios where strict control of the session life cycle is required, such as financial applications; idle session timeout is suitable for applications that want users to keep their session active for a long time, such as social media.

What steps would you take if sessions aren't working on your server?What steps would you take if sessions aren't working on your server?May 03, 2025 am 12:19 AM

The server session failure can be solved through the following steps: 1. Check the server configuration to ensure that the session is set correctly. 2. Verify client cookies, confirm that the browser supports it and send it correctly. 3. Check session storage services, such as Redis, to ensure that they are running normally. 4. Review the application code to ensure the correct session logic. Through these steps, conversation problems can be effectively diagnosed and repaired and user experience can be improved.

What is the significance of the session_start() function?What is the significance of the session_start() function?May 03, 2025 am 12:18 AM

session_start()iscrucialinPHPformanagingusersessions.1)Itinitiatesanewsessionifnoneexists,2)resumesanexistingsession,and3)setsasessioncookieforcontinuityacrossrequests,enablingapplicationslikeuserauthenticationandpersonalizedcontent.

What is the importance of setting the httponly flag for session cookies?What is the importance of setting the httponly flag for session cookies?May 03, 2025 am 12:10 AM

Setting the httponly flag is crucial for session cookies because it can effectively prevent XSS attacks and protect user session information. Specifically, 1) the httponly flag prevents JavaScript from accessing cookies, 2) the flag can be set through setcookies and make_response in PHP and Flask, 3) Although it cannot be prevented from all attacks, it should be part of the overall security policy.

What problem do PHP sessions solve in web development?What problem do PHP sessions solve in web development?May 03, 2025 am 12:02 AM

PHPsessionssolvetheproblemofmaintainingstateacrossmultipleHTTPrequestsbystoringdataontheserverandassociatingitwithauniquesessionID.1)Theystoredataserver-side,typicallyinfilesordatabases,anduseasessionIDstoredinacookietoretrievedata.2)Sessionsenhances

What data can be stored in a PHP session?What data can be stored in a PHP session?May 02, 2025 am 12:17 AM

PHPsessionscanstorestrings,numbers,arrays,andobjects.1.Strings:textdatalikeusernames.2.Numbers:integersorfloatsforcounters.3.Arrays:listslikeshoppingcarts.4.Objects:complexstructuresthatareserialized.

How do you start a PHP session?How do you start a PHP session?May 02, 2025 am 12:16 AM

TostartaPHPsession,usesession_start()atthescript'sbeginning.1)Placeitbeforeanyoutputtosetthesessioncookie.2)Usesessionsforuserdatalikeloginstatusorshoppingcarts.3)RegeneratesessionIDstopreventfixationattacks.4)Considerusingadatabaseforsessionstoragei

What is session regeneration, and how does it improve security?What is session regeneration, and how does it improve security?May 02, 2025 am 12:15 AM

Session regeneration refers to generating a new session ID and invalidating the old ID when the user performs sensitive operations in case of session fixed attacks. The implementation steps include: 1. Detect sensitive operations, 2. Generate new session ID, 3. Destroy old session ID, 4. Update user-side session information.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)