Dynamic queries in stored procedure

From: Greg Jaskiewicz <gryzman(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Dynamic queries in stored procedure
Date: 2013-07-05 13:57:06
Message-ID: 96F5E9DF-8F6E-4EF6-B0AE-43B585B11F94@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hey,

We have a search method that depending on search params will join 3-5 tables, craft the joins and where section. Only problem is, this is done in rather horrible java code. So using pgtap for tests is not feasible.
I want to move the database complexity back to database, almost writing the query construction in the plpgsql or python as stores procedure, any suggestions ?

Unfortunately PostgreSQL won't eliminate unnecessary joins from a view, so I can't just create one view and simple code adding where's, order by, etc.

No, I don't want to use orm.

Thanks.

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Andrew Dunstan 2013-07-05 14:26:42 Re: Dynamic queries in stored procedure
Previous Message David Johnston 2013-07-03 17:40:48 Re: My changes in the postgresql.conf does not work