Search Postgresql Archives

Do I need serializable for this query?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a table that keeps running totals. It is possible that this would get called twice simultaneously for the same UserID. Do I need to put this in a serializable transaction? Since this gets called often, could it be a performance problem if I make it serializable?

CREATE FUNCTION UpdateTotals(IN UserID int,
                             IN AddToCount int,
                             IN AddToSize bigint)
RETURNS void AS $$
BEGIN
    UPDATE
        Totals
    SET
        TotalSize = TotalSize + $2,
        TotalCount = TotalCount + $3
    WHERE
        UserID = $1;
    END IF;
END
$$ LANGUAGE 'plpgsql' VOLATILE;


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux