Without a query, the DDL for all tables and indexes involved and the result from
explain(analyze, verbose, buffers, settings)
it's impossible to improve the performance of this query. Could you please share some information? (in plain text, as an update of your question)