search
HomeDatabaseMysql Tutorial从客户端提升SQL Server数据库性能

从客户端提升SQL Server数据库性能

Jun 07, 2016 pm 03:23 PM
serversqlclientperformancepromotedatabaseEnter

欢迎进入Windows社区论坛,与300万技术人员互动交流 >>进入 第三:在客户端采用高速缓存提高服务器性能。 我们都知道,数据库在设计的时候,也用到了缓存。缓存是操作系统内存中间的一个模块。因为从内存中读取数据要比在硬盘中读取数据要快的多,所以,在数

欢迎进入Windows社区论坛,与300万技术人员互动交流 >>进入

  第三:在客户端采用高速缓存提高服务器性能。

  我们都知道,数据库在设计的时候,也用到了缓存。缓存是操作系统内存中间的一个模块。因为从内存中读取数据要比在硬盘中读取数据要快的多,所以,在数据库中通过把拥护查询过的数据记入到缓存中去,从而可以服务器的性能。

  现在有些程序开发人员更进一步。在客户端应用程序上,也可以假如缓存。客户端的缓存跟服务器端的缓存有异曲同工之妙。当某个用户查询了采购定单价格变更记录的时候,即使用户关掉了表,则其查询的数据仍然会在一定时间内保存在客户端的缓存中。当用户下次需要这方面数据的时候,则客户端就不会直接从数据库服务器从查询,而是先从客户端的缓存中找起。只有客户端应用软件的缓存中没有这方面信息的时候,才会把语句反馈给服务器,从服务器中提取数据。通过这种方式,就可以在客户端上分担服务器的压力,改善SQL Server数据库的性能。

  不过,若在客户端设置了高速缓存的话,则最好在应用软件上,增加清除高速缓存的按纽。因为在默写情况下,我们可能想要知道即使更改的结果,而不是最后一个看到。如我们在服务器上,改变了某个金额。但是,由于在客户端上刚查询过这方面的数据,数据内容还在缓存中。则仍然显示的是哪个未改过之前的情况。此时,就需要通过“清除高速缓存”的方法来及时的看到改变后的内容。

    第四:在前台实现表的完整性约束。

  如果在后台数据库实现表的完整性约束,如某个字段不能为空的话,则需要经过很多个步骤。如客户端程序先把结果传递给表;然后在存储的时候,发现某个字段为空,不符合表的完整性约束的要求;数据库拒绝保存这条记录,并返回错误信息;数据库服务器把这个结果传递给客户端。很显然,这种处理机制比较麻烦。那么有没有什么简单的解决方法呢?

  其实,我们若通过前台的客户端应用程序来实现表的完整性约束,可能对数据库的性能更加的有利。如在前台的客户端界面中,有某个字段不能为空。此时,我们就可以在前台应用程序开发的时候,加一限制,当这个字段为空的时候,不能保存。在前台客户端都不能够保存的数据,则当然不会传递给后台的数据库服务器。通过这种在前台实现表的完整性约束,就可以减少这个处理的过程。可以保障传递给后台数据库的内容都是符合完整性约束的。

  另外,就拿默认值来说,也是在客户端应用程序中实现来的便捷。如笔者在数据库开发的时候,需要有一个记录创建与更新日期。这两个字段的话,就可以在为其创建默认日期。现在的问题就是是在前台客户端程序实现呢,还是在后台的数据库中实现限制呢?笔者比较倾向与前台。因为在前台,客户端直接会把当前的默认值传递给服务器,服务器直接保存即可。而不用触发服务器的默认日期的存储过程。

  总之,笔者认为,我们在考虑改善数据库性能的时候,需要客户端与服务器端一起努力。或许通过这种方式,可以给我们一些意外的收获。使用过后,大家可能都会由衷的发表感叹,认同笔者的做法。

  [1] [2] 

从客户端提升SQL Server数据库性能

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
MySQL BLOB : are there any limits?MySQL BLOB : are there any limits?May 08, 2025 am 12:22 AM

MySQLBLOBshavelimits:TINYBLOB(255bytes),BLOB(65,535bytes),MEDIUMBLOB(16,777,215bytes),andLONGBLOB(4,294,967,295bytes).TouseBLOBseffectively:1)ConsiderperformanceimpactsandstorelargeBLOBsexternally;2)Managebackupsandreplicationcarefully;3)Usepathsinst

MySQL : What are the best tools to automate users creation?MySQL : What are the best tools to automate users creation?May 08, 2025 am 12:22 AM

The best tools and technologies for automating the creation of users in MySQL include: 1. MySQLWorkbench, suitable for small to medium-sized environments, easy to use but high resource consumption; 2. Ansible, suitable for multi-server environments, simple but steep learning curve; 3. Custom Python scripts, flexible but need to ensure script security; 4. Puppet and Chef, suitable for large-scale environments, complex but scalable. Scale, learning curve and integration needs should be considered when choosing.

MySQL: Can I search inside a blob?MySQL: Can I search inside a blob?May 08, 2025 am 12:20 AM

Yes,youcansearchinsideaBLOBinMySQLusingspecifictechniques.1)ConverttheBLOBtoaUTF-8stringwithCONVERTfunctionandsearchusingLIKE.2)ForcompressedBLOBs,useUNCOMPRESSbeforeconversion.3)Considerperformanceimpactsanddataencoding.4)Forcomplexdata,externalproc

MySQL String Data Types: A Comprehensive GuideMySQL String Data Types: A Comprehensive GuideMay 08, 2025 am 12:14 AM

MySQLoffersvariousstringdatatypes:1)CHARforfixed-lengthstrings,idealforconsistentlengthdatalikecountrycodes;2)VARCHARforvariable-lengthstrings,suitableforfieldslikenames;3)TEXTtypesforlargertext,goodforblogpostsbutcanimpactperformance;4)BINARYandVARB

Mastering MySQL BLOBs: A Step-by-Step TutorialMastering MySQL BLOBs: A Step-by-Step TutorialMay 08, 2025 am 12:01 AM

TomasterMySQLBLOBs,followthesesteps:1)ChoosetheappropriateBLOBtype(TINYBLOB,BLOB,MEDIUMBLOB,LONGBLOB)basedondatasize.2)InsertdatausingLOAD_FILEforefficiency.3)Storefilereferencesinsteadoffilestoimproveperformance.4)UseDUMPFILEtoretrieveandsaveBLOBsco

BLOB Data Type in MySQL: A Detailed Overview for DevelopersBLOB Data Type in MySQL: A Detailed Overview for DevelopersMay 07, 2025 pm 05:41 PM

BlobdatatypesinmysqlareusedforvoringLargebinarydatalikeImagesoraudio.1) Useblobtypes (tinyblobtolongblob) Basedondatasizeneeds. 2) Storeblobsin Perplate Petooptimize Performance.3) ConsidersxterNal Storage Forel Blob Romana DatabasesizerIndimprovebackupupe

How to Add Users to MySQL from the Command LineHow to Add Users to MySQL from the Command LineMay 07, 2025 pm 05:01 PM

ToadduserstoMySQLfromthecommandline,loginasroot,thenuseCREATEUSER'username'@'host'IDENTIFIEDBY'password';tocreateanewuser.GrantpermissionswithGRANTALLPRIVILEGESONdatabase.*TO'username'@'host';anduseFLUSHPRIVILEGES;toapplychanges.Alwaysusestrongpasswo

What Are the Different String Data Types in MySQL? A Detailed OverviewWhat Are the Different String Data Types in MySQL? A Detailed OverviewMay 07, 2025 pm 03:33 PM

MySQLofferseightstringdatatypes:CHAR,VARCHAR,BINARY,VARBINARY,BLOB,TEXT,ENUM,andSET.1)CHARisfixed-length,idealforconsistentdatalikecountrycodes.2)VARCHARisvariable-length,efficientforvaryingdatalikenames.3)BINARYandVARBINARYstorebinarydata,similartoC

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

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.