Title: Slow Database @ AWS
Last modified: December 29, 2020

---

# Slow Database @ AWS

 *  [llndave](https://wordpress.org/support/users/llndave/)
 * (@llndave)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/slow-database-aws/)
 * Hi there,
    is there any way to optimize my DB since aws made my shop rly slow?
 * I only need “SKU” and “title” search.
    I have used the following code. But my
   AWS_index table still looks like this:(image attatched)
 * Can I just delete all and rescan?
    or delete all columns (term_source, type, 
   count, in_stock, on_sale, term_id, visibility,) in phpmyadmin that i dont need?
   And the lines for: not SKU / not title.
 * Like I said I only need AWS to search for SKUs and Titles of Products.
 * Kind Regards
    Dave Picture of DB: [https://we.tl/t-Bi55CDfvWk](https://we.tl/t-Bi55CDfvWk)
 * //aws search filter
 * add_filter(‘aws_indexed_data’, ‘my_aws_indexed_data’);
    function my_aws_indexed_data(
   $data ) { $new_terms = array(); foreach ( $data[‘terms’] as $source => $all_terms){
   if ( strpos( $source, ‘title’ ) === 0 || strpos( $source, ‘sku’ ) === 0 ) { $
   new_terms[$source] = $all_terms; } } $data[‘terms’] = $new_terms; return $data;}

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [ILLID](https://wordpress.org/support/users/mihail-barinov/)
 * (@mihail-barinov)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/slow-database-aws/#post-13848361)
 * Hello,
 * Well your code
 *     ```
       add_filter('aws_indexed_data', 'my_aws_indexed_data');
       function my_aws_indexed_data( $data ) {
           $new_terms = array();
           foreach ( $data['terms'] as $source => $all_terms ) {
               if ( strpos( $source, 'title' ) === 0 || strpos( $source, 'sku' ) === 0 ) {
                   $new_terms[$source] = $all_terms;
               }
           }
           $data['terms'] = $new_terms;
           return $data;
       }
       ```
   
 * looks good. So just add it to your site and then re-index plugin table from the
   plugin settings page. This must works for you.
 * Regards
 *  Thread Starter [llndave](https://wordpress.org/support/users/llndave/)
 * (@llndave)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/slow-database-aws/#post-13848670)
 * its your code 🙂
    i added it and then reindexed before my ticket here. But it
   doesnt delete the columns and lines i dont need :S should i delete them and then
   reindex or is the code not working?
 *  Plugin Author [ILLID](https://wordpress.org/support/users/mihail-barinov/)
 * (@mihail-barinov)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/slow-database-aws/#post-13852022)
 * Strange. Can you please tell me where you add this code snippet? Or better – 
   show me this via some screenshot.
 *  Thread Starter [llndave](https://wordpress.org/support/users/llndave/)
 * (@llndave)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/slow-database-aws/#post-13852133)
 * child theme functions.php
    the functions.php works fine since i have 10 ish codes
   running
 *  Plugin Author [ILLID](https://wordpress.org/support/users/mihail-barinov/)
 * (@mihail-barinov)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/slow-database-aws/#post-13856185)
 * It is still strange, because this code must work. Maybe you are using the same
   filter `aws_indexed_data` also somewhere else inside you theme and this filter
   overwrites indexed data?
 * Also – maybe you can try, for test purposes, add this code somewhere else and
   try to re-index the table? Then this code can be removed.
 * Regards

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Slow Database @ AWS’ is closed to new replies.

 * ![](https://ps.w.org/advanced-woo-search/assets/icon-256x256.png?rev=3303984)
 * [Advanced Woo Search - Product Search for WooCommerce](https://wordpress.org/plugins/advanced-woo-search/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-woo-search/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-woo-search/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-woo-search/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-woo-search/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-woo-search/reviews/)

## Tags

 * [aws](https://wordpress.org/support/topic-tag/aws/)
 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 5 replies
 * 2 participants
 * Last reply from: [ILLID](https://wordpress.org/support/users/mihail-barinov/)
 * Last activity: [5 years, 5 months ago](https://wordpress.org/support/topic/slow-database-aws/#post-13856185)
 * Status: not resolved