search
Homephp教程php手册用PHP连MySQL和Oracle数据库性能比较

用PHP连MySQL和Oracle数据库性能比较

May 25, 2016 pm 04:53 PM
mysqloraclePerformance comparisondatabase

测试硬件说明:

测试使用的是我的爱机,配置如下:

CPU:C433

内存:128M

硬盘:酷鱼2代20G

测试软件说明:WIN32下用的是windows nt server4,sp5,apache 1.3.12,php3.0.15和php4rc1,mysql 3.22.29,oracle 8.0.5

linux下用的是bluepoint linux1.0, apache 1.3.12, php4rc1,mysql 3.22.32

测试代码说明:使用一个很简单的表,mysql和oracle使用的表结构是一样的,都只有三个字段,结构如下:

mysql的表结构:

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的结构:

CREATE TABLE PHP_ORACLE."BOARD" 
	("BOARD_ID" FLOAT, 
	"BOARD_NAME" CHAR(16) NOT NULL, 
	"BOARD_MANAGER" CHAR(20)) ;

我们只测试了INSERT操作花的时间,对于select,并未作测试。因为win32下只有PHP3才能连接oracle数据库,所以只测试了用PHP3连接oracle的性能。相信在PHP4的正式版本出来后,用PHP4连接oracle的速度应该有所提升。

而在LINUX下,因为我没有装oracle,所以只测试了mysql的性能。据说在LINUX下,oracle的性能不错,只是无法测试。

并且我们将所有的用于数据库连接和oracle用来分析sql语句的代码都放在了统计代码之外,所以测试得出的时间只是用于执行SQL操作所花费的时间。

用来测试mysql的程序:

<?php

$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 (&#39;test&#39;,&#39;test&#39;)";
$begin_time = time();
for ($i = 1; $i <= 10000; $i) {
    mysql_db_query("bbs", $query);
    $counter;
}
$end_time = time();
mysql_close($dblink);
echo "test db speed...<br>";
echo "begin time:" . $begin_time . "<BR>";
echo "<BR>end time:" . $end_time . "<BR>";
?>


               
               

永久地址:

转载随意~请带上教程地址吧^^

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

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),

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.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.