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

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

May 25, 2016 pm 04:53 PM
mysql oracle Performance comparison database

测试硬件说明:

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

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) 
	);
Copy after login

oracle的结构:

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

我们只测试了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>";
?>
Copy after login


               
               

永久地址:

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

Statement of this Website
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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to optimize MySQL query performance in PHP? How to optimize MySQL query performance in PHP? Jun 03, 2024 pm 08:11 PM

MySQL query performance can be optimized by building indexes that reduce lookup time from linear complexity to logarithmic complexity. Use PreparedStatements to prevent SQL injection and improve query performance. Limit query results and reduce the amount of data processed by the server. Optimize join queries, including using appropriate join types, creating indexes, and considering using subqueries. Analyze queries to identify bottlenecks; use caching to reduce database load; optimize PHP code to minimize overhead.

How to fix mysql_native_password not loaded errors on MySQL 8.4 How to fix mysql_native_password not loaded errors on MySQL 8.4 Dec 09, 2024 am 11:42 AM

One of the major changes introduced in MySQL 8.4 (the latest LTS release as of 2024) is that the &quot;MySQL Native Password&quot; plugin is no longer enabled by default. Further, MySQL 9.0 removes this plugin completely. This change affects PHP and other app

How to create a MySQL table using PHP? How to create a MySQL table using PHP? Jun 04, 2024 pm 01:57 PM

Creating a MySQL table using PHP requires the following steps: Connect to the database. Create the database if it does not exist. Select a database. Create table. Execute the query. Close the connection.

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

How does Go WebSocket integrate with databases? How does Go WebSocket integrate with databases? Jun 05, 2024 pm 03:18 PM

How to integrate GoWebSocket with a database: Set up a database connection: Use the database/sql package to connect to the database. Store WebSocket messages to the database: Use the INSERT statement to insert the message into the database. Retrieve WebSocket messages from the database: Use the SELECT statement to retrieve messages from the database.

How to handle database connection errors in PHP How to handle database connection errors in PHP Jun 05, 2024 pm 02:16 PM

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

How to delete data from MySQL table using PHP? How to delete data from MySQL table using PHP? Jun 05, 2024 pm 12:40 PM

PHP provides the following methods to delete data in MySQL tables: DELETE statement: used to delete rows matching conditions from the table. TRUNCATETABLE statement: used to clear all data in the table, including auto-incremented IDs. Practical case: You can delete users from the database using HTML forms and PHP code. The form submits the user ID, and the PHP code uses the DELETE statement to delete the record matching the ID from the users table.

See all articles