Download the PHP package helbrary/db-performance without Composer

On this page you can find all versions of the php package helbrary/db-performance. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package db-performance

DbPerformance

This library is useful for bulk import to database.

Install in composer.json

Multi-insert

Create instance

Third parameter in constructor is buffer limit (optionaly). Default value is 100. It means that if buffer contains 100 records and we wont add next record, it's build multi insert and send to database. Buffer is empty and to buffer is add new record.

Add record to buffer (function don't insert record to database yet)

If we add to buffer all records, it's necessary insert records to database from buffer.

Multi-insert Failed

In case throw exception in database, for example constraint violations, is multi-insert divide into single inserts. These single inserts are send to database individually (one record = one insert). When single insert throw exception, it's invoke callback $onFailure.

OnFailure callback

Multi-update

Create instance

Add record to buffer (function don't update record in database yet)

If we add to buffer all records to update, it's necessary send update records to database from buffer

Recommended buffer limit

Buffer limit defines how many SQL commands will be joined to one multi-command. Default value of buffer limit is 100. It's possible to change this value in constructor by variable $limit. If SQL commands will throw some type of Exception often, it's better set buffer smaller. If SQL commands will throw some type of Exception rarely it's better set buffer higher.

Testing - Insert 100 000 records (no SQL INSERT throw Exceptions)

1) One by one record: 16 min 55 sec

2) One by one record in transaction: 4 min 50 sec

3) Using Helbrary\DbPerformance\MultiInsert with (default) buffer size 100: 0 min 20 sec

4) Using Helbrary\DbPerformance\MultiInsert with buffer size 500: 0 min 14 sec

5) Using Helbrary\DbPerformance\MultiInsert with buffer size 1000: 0 min 12 sec

6) Using Helbrary\DbPerformance\MultiInsert with buffer size 10000: 0 min 11 sec


All versions of db-performance with dependencies

PHP Build Version
Package Version
Requires php Version >= 5.3.7
nette/database Version >= 2.2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package helbrary/db-performance contains the following files

Loading the files please wait ....