On Thu, Dec 5, 2013 at 1:19 PM, bricklen <bricklen@xxxxxxxxx> wrote:
On Thu, Dec 5, 2013 at 10:08 AM, Scott Marlowe <scott.marlowe@xxxxxxxxx> wrote:
Rules have a lot of overhead. Is there a reason you're not using
defaults or triggers?Or for even less overhead, load the partitions directly, and preferably use "DEFAULT nextval('some_sequence')" as Scott mentioned.
The rule is being used to return the id of the insert, it's not part of the partitioning itself. The id is generated with default nextval. I've looked at using returning instead but that will require a large refactoring of the codebase and seems to have issues when combined with the partitioning. The partitioning is done with a BEFORE INSERT ON trigger. The trigger proc doesn't do any selects, it's just based on the contents of the insert itself.