There are just so many factors that go into writing a query that will be performant, not just basic indexes but joins vs. subqueries, single-column indexes vs. multi-column indexes with various sort orders, etc. And even if you write something that's performant at 1,000 rows in your test database, it falls apart with 1,000,000 rows in production.
But reliable AI that can actually understand all your queries together with the database structure, in order to find performance improvements, feels like it's going to become as helpful on the database side as Copilot etc. is on the regular coding side.