在下拉列表中加载5000或以上条目时,需要时间加载到几秒钟

<div class="row invoice-info">
                    <div class="col-sm-4 invoice-col">
                      <b>To,</b>
                      <address>
                        <select name="customer_id" readonly id="customer_id" title="Select Customer" class="form-control select2" required="">
                          <?php echo $customer_options; ?>
                        </select><br>
                        <b>Address:</b><span id="customer_address"></span><br>
                        <b>Phone:</b> <span id="customer_phone"></span><br>
                        <b>Email:</b> <span id="customer_email"></span>
                      </address>
                    </div>
</div>

When loading 5000 or above entries in a Dropdown, it is taking time to load to few seconds. I want to make it quick.

As you are searching name, You can add additional select box for alphabet selection and then make a ajax call for search result with name starting with selected alphabet...

e.g.

<select name='alphabet_select" >
   <option value="">Select</option> 
   <option value="A">A</option>
   <option value="B">B</option>
   <option value="C">C</option>
   .....
   <option value="Z">Z</option>
</select>

After selecting alphabet, make ajax call and retrieve names starting with that selected above alphabet..

e.g.

SELECT * FROM table_name WHERE name_column like '[$_POST['alphabet_select']%'; 

With this approach, you can limit result set records to speed up loading name dropdown..

Load more than 5000 records in drop down list

The good solution is not to load 5000 options into a DropDown via default dropdown or AJAX and any other method.

Instead

<select>
  <option value="Carvolvo"> Car Volvo</option>
  <option value="Samya">Samya</option>
  <option value="mercedes">Mercedes</option>
  <option value="audi">Audi</option>
</select>

Have you heard about the : https://select2.org/getting-started/basic-usage