pg_sql | Unsorted

Telegram-канал pg_sql - PostgreSQL

2830

English speaking PostgreSQL public chat. This group is for discussions on PostgreSQL-related topics and strives to provide best-effort support as well.

Subscribe to a channel

PostgreSQL

Yeah that is a virtual machine, from AWS, additionally. A phone is probably gonna be more powerful than that

Читать полностью…

PostgreSQL

What cpu model is it?

Читать полностью…

PostgreSQL

Well, you moved from 8 parallel workers to 2 parallel workers. Is the self managed server a virtual machine?

Читать полностью…

PostgreSQL

live session of Postgres [vibe] hacking happening now -- join! https://www.youtube.com/watch?v=6cZvHjDrmlQ&123

+ we created a telegram group to discuss our (and your!) postgres hacking activities: /channel/postgres_hacking

Читать полностью…

PostgreSQL

Thankyou so much i will check and get back to you

Читать полностью…

PostgreSQL

From basic to advanced

Читать полностью…

PostgreSQL

If you are under 2^31, fine, otherwise string

Читать полностью…

PostgreSQL

also: If you use JavaScript in the browser somewhere that numbers there are treated as floats and truncated as such

Читать полностью…

PostgreSQL

so numeric will give number in output (for typeorm) right? if I will change just 'float' to 'numeric' is it enough? or need to check the behaviour by the way?

Читать полностью…

PostgreSQL

thank you guys, I guess, I will change just that columns which is using for money (price, discount, amount, etc), thank you for advice

Читать полностью…

PostgreSQL

If it where me, I would use numeric at the DB level and BigDecimal in JS for anything handling money.

It upto you to make a judgement call on mixing things.

Читать полностью…

PostgreSQL

As Someone who made this mistake, trust me fixing it was NICE.

You simply cannot use Real/Float because they are not exact.
if you use Numeric, you will be in good shape. The math will always work.

Yes, it's bigger.
The only other way is more complicated. Use a BigInt with an IMPLIED decimal point.
(The COBOL Solution).

Читать полностью…

PostgreSQL

The biggest issue with using real or double precision types is they can't hold exact base 10 fractions, eg: 0.1 will loose some exactness. Which means you need to compute any money based maths at a higher number of decimal places and then round stuff.

Numeric and float can interop it'll just depend what you're storing where.

But life is much easier if you just use Numeric and something like BigDecimal in your app layer.

Читать полностью…

PostgreSQL

That likely depends on your client library. But the numeric type is what you need to keep exactness.

Читать полностью…

PostgreSQL

hi, for floating numbers, what the best use like for discount, price, purchase double precision or decimal?

Читать полностью…

PostgreSQL

m6g large .. graviton2

Читать полностью…

PostgreSQL

Exactly identical machines with 2 cpu with 8G ram

Читать полностью…

PostgreSQL

Hey hi, We have recently migrated postgresql 15 in RDS to self managed postgres 16. But query performance dropped down. Query X runs within expected latency for 1 or 2 times but for subsequent times, we could see it is taking more time. It is just 2 core cpu and 8g memory.
There were few parameter difference we noticed related to max_worker_processes , max_parallel_workers and max_parallel_workers_per_gather and shared_buffers and effective_cache_size. Do these configs contribute to performance drop and make any significance?
https://paste.laravel.io/a5cdd6fc-d58f-49e7-b5ab-596d1ea9a9a1

Is it even reasonable to set max_parallel_workers more than CPU cores?

Читать полностью…

PostgreSQL

from docs:

When rounding values, the numeric type rounds ties away from zero, while (on most machines) the real and double precision types round ties to the nearest even number

so when rounding number:
* 2.5 will be 3 with numeric (num)
* and become 2 with double precision (dp)

with dp, arithmetic operation would possibly introduce buggy code.

because 0.5 will also become 1 with num. and 0 with dp. 😅

means a lot when calculate everything related to money.

Читать полностью…

PostgreSQL

Actually, the documentation is pretty good: https://www.postgresql.org/docs/
If you prefer videos, there are many available on YouTube and several members of this channel also wrote books on it.
Yes, it is possible, we all started at some point.

Читать полностью…

PostgreSQL

I want to learn postgresql

Читать полностью…

PostgreSQL

Yeh, Stripe does stuff like pass them as integers at cent / pence level.

Читать полностью…

PostgreSQL

I don't know typeorm. I would hope it would map to the BigDecimal JS type. There is no point use numeric and the DB level and floating point at the app level.

Читать полностью…

PostgreSQL

You might need to for quantity too, depending on usecases and where you do math.

Читать полностью…

PostgreSQL

It's also important when dealing with money, to know what form of rounding you need to use where.

Читать полностью…

PostgreSQL

The other fun thing, is the numeric rounding function does slightly different things to the double precision rounding function. Which would be important in money situations.

Читать полностью…

PostgreSQL

I agree with you, but now the biggest problem, I already integrated float (double precision) into project, and I didn't see any strange behavior in production, because the code is checking the number, rounding and etc before inserting to the table. Yes, unfortunatle I didn't know about their big differences, and now when I'm asking chatgpt, it says need to use decimal or numeric instead of double precision. Is it big dileme if I will use numeric just for new tables and new columns for the future? cause I don't want to change whole project(

Читать полностью…

PostgreSQL

I used float in typeorm (double precision in postgre) for all my projects, and now I need to integrate purchase transactions, can I make it as hybrid in this situation?

Читать полностью…

PostgreSQL

is it giving number as string in output?

Читать полностью…

PostgreSQL

Double that, plus a bit.
With the RAID and the boatload of storage!
And enough open slots for more storage.
Again, we usually shoot for 5 years of service.

Upside of PG is that we spun up some cloud based services for lower tier stuff. Very cost effective!
Oracle wanted a kings ransom to do any of it.

Читать полностью…
Subscribe to a channel