Код приложил ниже, хотелось бы узнать насколько такой код будет быстро работать при огромных нагрузках, многопользовательское приложение. Жду любых предложений !
cursor.execute("SELECT owner_id FROM parties WHERE city LIKE (%s) ORDER BY random()", (city,))
owner_id = cursor.fetchone()
parties_exist = owner_id
cursor.execute("SELECT des FROM parties WHERE owner_id = (%s)", (owner_id,))
des = cursor.fetchone()
cursor.execute("SELECT photo FROM parties WHERE owner_id = (%s)", (owner_id,))
party_photo = cursor.fetchone()
result1 = party_photo
cursor.execute("SELECT people FROM parties WHERE owner_id = (%s)", (owner_id,))
people = cursor.fetchone()
cursor.execute("SELECT video FROM parties WHERE owner_id = (%s)", (owner_id,))
party_video = cursor.fetchone()
result2 = party_video
if parties_exist:
if result1[0]:
await bot.send_photo(message.from_user.id, f'{party_photo[0]}', caption=f'{city[0]}\n\n{des[0]}\n\nЛюдей будет: {people[0]}')
elif result2[0]:
await bot.send_video(message.from_user.id, f'{party_video[0]}', caption=f'{city[0]}\n\n{des[0]}\n\nЛюдей будет: {people[0]}')
else:
await bot.send_message (message.from_user.id, f'{city[0]},\n{des[0]}\n\nЛюдей будет: {people[0]}', parse_mode=types.ParseMode.HTML)
else:
await bot.send_message (message.from_user.id, f'Встреч не найдено !',reply_markup=party_kb, parse_mode=types.ParseMode.HTML)