Question: Product Details Take Too Long

Product Details Take Too Long

First Sorry for my english native language spanish I have been using sma for many years. When enter product details it takes an eternity to show Transfers and products quantities adjustm

GL

Gabriel lEVIN

Asked
First Sorry for my english native language spanish
I have been using sma for many years.

When enter product details it takes an eternity to show Transfers and products quantities adjustments
I need possible solutions to it pls
also when this happen mysql use 100% cpu
  • EG

    Enyinnaya Gift

    Answered
    Hello [@Gabriel lEVIN](/u/gabriel)

    If your **Transfers** and **Product Quantity Adjustments** take too long to load and MySQL reaches 100% CPU usage, here are some possible solutions:

    ### 1. Reduce the number of rows per page
    Go to **System Settings** and lower the **Rows per page** value. If it's currently set to **100**, try reducing it to **50** or **25**.

    ### 2. Ensure proper indexing
    Make sure that `product_id` and `transfer_id` in the `sma_transfer_items` table are **indexed**. This will improve query performance.

    ### 3. Optimize database indexing
    Run the following queries to add indexes to key columns, improving query speed:

    ```sql
    ALTER TABLE `sma_transfer_items`
    ADD INDEX `transfer_id` (`transfer_id`);

    ALTER TABLE `sma_sales`
    ADD INDEX `warehouse_id` (`warehouse_id`);

    ALTER TABLE `sma_sale_items`
    ADD INDEX `option_id` (`option_id`);

    ALTER TABLE `sma_quotes`
    ADD INDEX `warehouse_id` (`warehouse_id`);

    ALTER TABLE `sma_quote_items`
    ADD INDEX `option_id` (`option_id`);

    ALTER TABLE `sma_purchases`
    ADD INDEX `warehouse_id` (`warehouse_id`);
    ```

    ---

    ## About Me

    My name is **[@Enyinnaya Gift](/u/giftedhands4real)**, and I am an **Independent Software Developer** with in-depth knowledge of the **SMA system**. I have successfully implemented numerous customizations for happy clients worldwide.

    ### πŸ”Ή Check out a demo of my latest customization:
    [Click HERE - Highlights](https://sma.gehandsitsolutions.com/)

    ### πŸ“ž Reach me for real-time discussions on your customization requests via:

    πŸ“Œ **Skype:** `enyinnayag`
    πŸ“Œ **WeChat:** `genyinnaya`
    πŸ“Œ **Email:** `[email protected]`
    πŸ“Œ **WhatsApp:** `+2348068355192`
  • MS

    Mian Saleem

    Answered
    Thank you for helping [@Enyinnaya Gift](/u/giftedhands4real)
  • GL

    Gabriel lEVIN

    Answered
    Hi, thx for the fast response, no improvements, just take 10 minutos or no response at all to show resultos, in transfer details and Quantity adjusts.
  • MS

    Mian Saleem

    Answered
    Hello,

    Did you add indexes?

    ```sql
    ALTER TABLE `sma_transfer_items`
    ADD INDEX `transfer_id` (`transfer_id`);
    ALTER TABLE `sma_transfer_items`
    ADD INDEX `product_id` (`product_id`);
    ALTER TABLE `sma_transfer_items`
    ADD INDEX `warehouse_id` (`warehouse_id`);

    ALTER TABLE `sma_purchases`
    ADD INDEX `warehouse_id` (`warehouse_id`);

    ALTER TABLE `sma_purchase_items`
    ADD INDEX `transfer_id` (`transfer_id`);
    ALTER TABLE `sma_purchase_items`
    ADD INDEX `product_id` (`product_id`);
    ALTER TABLE `sma_purchase_items`
    ADD INDEX `warehouse_id` (`warehouse_id`);
    ```

    How many transfers and purchases do you have? What are the specs of your server? Please increase the memory_limit to minimum 256M in your php config file.

    Thank you
  • GL

    Gabriel lEVIN

    Answered
    No solution yet, I did all the indexes.
    10141 transfers.
    9532 Puchases.
  • GL

    Gabriel lEVIN

    Answered
    The last one solve the problem, txh Mian Saleem
    I didnt see the add ons u made on the sql code.
  • MS

    Mian Saleem

    Answered
    Hello,

    I am glad that you noticed and the indexes improved the query time.

    Thank you for updating
  • GL

    Gabriel lEVIN

    Answered
    Hi now i have this problem
    I dont know if this is the resultt of this chanches.
    can u help me ?
    Only happend when i try to change state to Completed
    In transfers.
  • MS

    Mian Saleem

    Answered
    Hello,

    The product doesn't have the quantity you transferring in the from warehouse. Please check the quantity in the from warehouse.

    Thank you
  • GL

    Gabriel lEVIN

    Answered
    The item is sent but, the error happen when the other side try to confirm the transfer, status sent to completed.
    If i do transfer with completed status , direct, the error is not presented.
  • Login to Reply