打印本文 打印本文 关闭窗口 关闭窗口
Integer GUID和Comb做主键的效率测试(Delphi+access)(二)
作者:武汉SEO闵涛  文章来源:敏韬网  点击数4088  更新时间:2009/4/23 18:25:46  文章录入:mintao  责任编辑:mintao

看一下我们的表格构:

 

 

 TInteger表是用自动加1字段做为主键(PInt)

TGuid表是用GUID做为主键(PGUID)

PComb表是用Comb做为主键(PComb)

PComb2表是用改过后的Comb做为主键(PComb,第四种情况)

在这四表中还有一列,NInt,用于插入一个数值,随机的,没有什么实际的意义

 

 

 

下面先看一下我们的测试界面:

 

 

 

插入数据是指在数据库的四个表中插入指定条目的数据.

Count(*)是在四个表中用select cocunt(*) as rc from table做统计查询

Count是在四个表中用select cocunt(主键) as rc from table做统计查询

 

 

 

Label3,Label5,Label7,Label9分别是四个表所运行的时间.

 

 

 

下面是测试程序:

 

 

 

unit Unit1;

 

 

 

interface

 

 

 

uses

  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  Dialogs, StdCtrls,Activex,SSystemUnit, ADODB, DB;

 

 

 

type

  TForm1 = class(TForm)

    ADOConnection1: TADOConnection;

    ADOCommand1: TADOCommand;

    Edit1: TEdit;

    Button1: TButton;

    Label1: TLabel;

    Label2: TLabel;

    Label3: TLabel;

    Label4: TLabel;

    Label5: TLabel;

    Label6: TLabel;

    Label7: TLabel;

    Button2: TButton;

    Button3: TButton;

    Label8: TLabel;

    Label9: TLabel;

    procedure Button1Click(Sender: TObject);

    procedure Button2Click(Sender: TObject);

    procedure Button3Click(Sender: TObject);

[1] [2] [3] [4]  下一页

打印本文 打印本文 关闭窗口 关闭窗口