Question: Why when I am using javascript the basic HTML inputs validation not performed?  

Say the min max attributes.

Here the HTML:

```
<form action="#" method="get">Quantity (between 1 and 5):
    <input type="number" name="quantity" min="1" max="5">
    <br />
    <input type="submit" value="with HTML">
</form>
<button id="sender">with JS</button>

```

JS:

```
$("#sender").click(function (event) {
    $("form").submit();
});

```

And live example: <http://jsfiddle.net/txP4R/2/>

Answer: 
MySQL is probably already doing what you describe, as much as it can.

In the case of InnoDB (which should be your default storage engine with MySQL), inserts and updates and deletes change primary key or unique key indexes immediately. But they never rebuild the *whole* index, they add new values into (or take values out of) these indexes.

For non-unique indexes, InnoDB performs [change buffering](https://dev.mysql.com/doc/refman/en/innodb-change-buffer.html). That is, it queues the changes, which will be merged into the index later in the background. It will even consolidate changes so that the physical updates to the index are done more efficiently.

You don't have to do anything to enable this feature, because it's enabled by default. MySQL 5.1 does change buffering only for `INSERT`. MySQL 5.5 and later additionally does change buffering for `UPDATE` and `DELETE`.

You can *disable* this feature if you want (for instance if you use SSD, avoiding random I/O is not so important, and you might want to ensure that queued changes don't accumulate). Normally, you should keep the feature enabled.
Note that MariaDB, which you are probably using if you apt install mysql on a modern system, removed the buffering mentioned in the accepted answer.

> 
> The change buffer has been disabled by default [in updates to] MariaDB 10.5, 10.6, 10.7, and 10.8, and the feature is deprecated and ignored from MariaDB 10.9.0.  
> 
> Benchmarks show that the change buffer sometimes reduces performance, and **in the best case seem to bring a few per cent improvement to throughput**. However, [if untimely crashes occur] then the InnoDB system tablespace can grow out of control.
> 
> 
> 

Paraphrased from <https://mariadb.com/kb/en/innodb-change-buffering/>, emphasis mine.

Oracle's database server still has this feature in their documentation for the latest version: <https://dev.mysql.com/doc/refman/8.0/en/innodb-change-buffer.html>