Postgresql – Cloud SQL high latency
I just deployed a small (1cpu, 600mb ram) db instance for Postgres. With barely any load, db is very slow, average latency is 1,5s. Ping for the DB IP is 190ms avg. I know it is high, but still it…
I just deployed a small (1cpu, 600mb ram) db instance for Postgres. With barely any load, db is very slow, average latency is 1,5s. Ping for the DB IP is 190ms avg. I know it is high, but still it…
I have a method that return value from sequence in Postgres: public long GetSId(DatabaseFacade d, string sequenceName) { var result = new NpgsqlParameter(":result", NpgsqlDbType.Integer) { Direction = System.Data.ParameterDirection.InputOutput, Value = 0 }; d.ExecuteSqlRaw($"SELECT nextval('{sequenceName}')", result); return (long)result.Value; } And I…
I'm trying to use a variable in a SQL statement however it comes up with the error: TypeError: function takes at most 2 arguments (3 given) To be honest, I'm no master programmer and have little experience with postgres so…
I have a given entity 'Student' with application based concurrency control defined on 'LastModified'. public class Student { public int Id { get; set; } public string Name { get; set; } = null!; public DateTimeOffset Created { get; set;…
I currently query data like this: SELECT * FROM mytable WHERE (start_date, end_date) OVERLAPS ('2023-10-01'::DATE, CURRENT_DATE); The problem is that I have to update this query every year. Is there a way to just use the previous 1st of October…
The situation is this: I have two columns in my database. User Parent Amy K. Theo K. Lena K. Theo K. Jiha L. John L. John L. Victor L. Theo K. Simba K. Simba K. Ellen K. Now I need…
I am finding it difficult to find the best way to set Postgres options for a pg_restore session only. It would be nice to be able to do this in the environment in which I run pg_restore and not change…
I have a service in which customers can open a "customer service ticket" which is charged. Whenever they do, they can open how many more "customer service tickets" they want for the next 30 days without being charged; and after…
I try to update my base SellAll with the value of a previous stock. I have this request so far : UPDATE SellAll set S_stock = (S_in - S_out) + monthn1.stock FROM ( SELECT LAG(S_stock,1,0) OVER (ORDER BY S_famille,S_year, S_month)…
i have a table like bellow in postgres start_at end_at 17/1/2023 15/3/2023 i want to split this like bellow start_at end_at 17/1/2023 31/1/2023 01/2/2023 28/2/2023 1/3/2023 15/3/2023 I have tried generate series of postgres but not able to generate desire…