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 doesn't "rebuild" the index after every insert. MySQL inserts one or more rows into an existing index.

MySQL has lots of unusual options, and I don't know all of them. I would be surprised if there were an option that said: "Oh, let the index on the table be out of synch with the data in the table." Doesn't sound reasonable.

If you have lots of inserts, the best strategy is to do the inserts in one statement. Instead of:

```
insert into t(...)
    select . . .
    from t2
    where id = id1;

```

Do:

```
insert into t(...)
    select . . .
    from t2
    where id in (id1, id2, . . .)

```

An extension on this is to insert into a temporary table. Then just load the temporary table into the big table all at once:

```
insert into t(...)
    select ...
    from temptable;

```

Finally, it is sometimes faster to drop indexes, do a big insert (in one or more steps), and then re-create the indexes.

One caution: if you drop unique indexes you are also dropping the unique constraint. This is important if you are using `on duplicate key update`, because it needs a secondary index to find the duplicate key (except for the primary key).
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>