FW: INSERT WHERE NOT EXISTS
От
Benjamin Jury
Тема
FW: INSERT WHERE NOT EXISTS
Дата
Msg-id
24DC688F52AAD611B60900096BB0B440015D82B6@chapar.mpuk.com
Список
> // check if entry already exists > SELECT COUNT(*) FROM tablename WHERE [cond] > .. > if($count >0) > UPDATE > else > INSERT > > but this will double the hit to the database server, because > for every > operation I need to do SELECT COUNT(*) first. The data itself > is not a lot, > and the condition is not complex, but the hitting frequency is a lot. Why not use plpgsql? CREATE FUNCTION a_test(int4) RETURNS int AS ' DECLARE totest int; BEGIN SELECT INTO totest FROM
В списке pgsql-general по дате отправления
От: Mark Kirkwood
Дата: