SELECT vendor_communications.thread_id, vendor_communications.storefront_id, vendor_communications.status, vendor_communications.user_id, vendor_communications.company_id, vendor_communications.object_id, vendor_communications.object_type, vendor_communications.last_message, vendor_communications.last_message_user_id, vendor_communications.last_message_user_type, vendor_communications.last_updated, vendor_communications.created_at, vendor_communications.communication_type, vendor_communications.subject, companies.company, users.firstname, users.lastname, users.email AS customer_email FROM cscart_vendor_communications AS vendor_communications  LEFT JOIN cscart_companies AS companies ON companies.company_id = vendor_communications.company_id  LEFT JOIN cscart_users AS users ON users.user_id = vendor_communications.user_id WHERE 1=1  AND vendor_communications.communication_type IN ('vendor_to_customer')  AND vendor_communications.status IN ('N')  ORDER BY vendor_communications.last_updated desc, vendor_communications.thread_id desc  LIMIT 0, 1000000

Query is invalid

JSON explain

{
  "query_block": {
    "select_id": 1,
    "read_sorted_file": {
      "filesort": {
        "sort_key": "vendor_communications.last_updated desc, vendor_communications.thread_id desc",
        "table": {
          "table_name": "vendor_communications",
          "access_type": "ALL",
          "rows": 2,
          "filtered": 100,
          "attached_condition": "vendor_communications.communication_type = 'vendor_to_customer' and vendor_communications.`status` = 'N'"
        }
      }
    },
    "table": {
      "table_name": "companies",
      "access_type": "eq_ref",
      "possible_keys": ["PRIMARY"],
      "key": "PRIMARY",
      "key_length": "4",
      "used_key_parts": ["company_id"],
      "ref": ["vietpom_dev.vendor_communications.company_id"],
      "rows": 1,
      "filtered": 100
    },
    "table": {
      "table_name": "users",
      "access_type": "eq_ref",
      "possible_keys": ["PRIMARY"],
      "key": "PRIMARY",
      "key_length": "3",
      "used_key_parts": ["user_id"],
      "ref": ["vietpom_dev.vendor_communications.user_id"],
      "rows": 1,
      "filtered": 100
    }
  }
}