So I have my master table:
p_reports: id(pk), web_id, other(data)
At the moment I create my partitions which inherits from p_reports
by using:
CREATE TABLE IF NOT EXISTS reports_#{web_id}(CHECK(web_id = #{web_id})) INHERITS (p_reports);
Then I do a bulk insert into that table, this works fine, but for this I need to group to create blocks of data for the specific partition, and do multiple inserts.
Is it posible to have a function, so I can send all my data at once, and the function will create partitions if they don't exist and then insert the data in the corresponding partition?
Aucun commentaire:
Enregistrer un commentaire