Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Problem load time server with query bagisto mysql 8

    General Discussion
    3
    3
    575
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      LilD last edited by LilD

      Hi, I have about 8000 products on the website and the search is super hard and etc .. and from what I saw it's from the product query
      How can I optimize it?

      $qb = $query->distinct()
                       ->select('product_flat.*')
                      ->addSelect('product_images.path as image')
                      ->join('product_flat as variants', 'product_flat.id', '=', DB::raw('COALESCE(' . DB::getTablePrefix() . 'variants.parent_id, ' . DB::getTablePrefix() . 'variants.id)'))
                      ->leftJoin('product_categories', 'product_categories.product_id', '=', 'product_flat.product_id')
                      ->leftJoin('product_attribute_values', 'product_attribute_values.product_id', '=', 'variants.product_id')
                      ->leftJoin('product_images', 'product_flat.product_id', '=', 'product_images.product_id')
                      ->where('product_flat.channel', $channel)
                      ->where('product_flat.locale', $locale)
                      ->whereNotNull('product_flat.url_key');
      
      1 Reply Last reply Reply Quote 0
      • devansh-webkul
        devansh-webkul last edited by

        This is an issue because of the product_attribute_values. Just try to fetch from the product_flats table column.

        1 Reply Last reply Reply Quote 0
        • ?
          A Former User last edited by

          Kindly recheck the attribute_values

          1 Reply Last reply Reply Quote 0
          • First post
            Last post