Progrider

Programming discussion

Recent posts

The newest topics and replies across all categories.

PostPosted
Help · post #3

For grades, that's fine. If it's money, don't use floats at all. Keep integer cents or use decimal.Decimal, and construct it from strings: Decimal("0.1"). Decimal(0.1) has the float's error in it alre…


by lintroller !-TjZOnKc
Help · post #2

No, it's how floats work. Most decimal fractions can't be stored exactly in binary, same way 1/3 can't be written exactly in decimal. Try 0.1 + 0.2 in Python. For display use round(x, 2) or a format s…


by mo
Help · post #1

Adding up marks that have decimals and then the total is sometimes 79.99999999 instead of 80. Is my computer broken? The numbers are like 12.1 and 7.3.


by bea
Help · post #12

Off. All good now, marking this one resolved.


by nils !PxNS1ZCy
Help · post #11

You can leave it on and raise jit_above_cost, or turn it off for that role. For a small OLTP box I'd just turn it off.


by marta_k !izYA-5cv
Help · post #10

880ms. Old package was built without LLVM support, turns out. Debian's has it.


by nils !PxNS1ZCy
Help · post #9

There's your extra second. It has decided the query's expensive enough to compile. Was jit off in your old config, or was it a different package build? Try SET jit = off in the session and run it agai…


by marta_k !izYA-5cv
Help · post #8

Top of it is: JIT: Functions: 42 Options: Inlining true, Optimization true, Expressions true, Deforming true Timing: Generation 8.1 ms, Inlining 310.2 ms, Optimization 612.4 ms, Emission 201.9 ms, Tot…


by nils !PxNS1ZCy
Help · post #7

EXPLAIN (ANALYZE, BUFFERS) it and paste it. Change the table names if you need to.


by marta_k !izYA-5cv
Help · post #6

Back to 20ms on most of it. Thanks. Still one report query that's slower than before, 2s where it was 900ms.


by nils !PxNS1ZCy
Help · post #5

The in-stages version does a very rough pass first, so the worst of it clears up fast. Then finer passes. Check pg_stat_user_tables, last_analyze should be getting filled in.


by marta_k !izYA-5cv
Help · post #4

Running. There's a line about it in the output I had scrolled past.


by nils !PxNS1ZCy
Help · post #3

Oh.


by nils !PxNS1ZCy
Help · post #2

Did you run the analyze step? pg_upgrade doesn't bring the planner statistics across, so right now it's guessing. It prints this at the end and everybody misses it. vacuumdb --all --analyze-in-stages


by marta_k !izYA-5cv
Help · post #1

Upgraded a small Postgres box over the weekend with pg_upgrade --link. It came up fine, no errors. Queries that took 20ms now take 8 seconds. Same hardware, same config carried across. One example doe…


by nils !PxNS1ZCy
General · post #4

vek you have never had to explain a CGI to someone who just wants the bank site to load.


by kettle
General · post #3

Write a one-button CGI that comments out the include. Thirty lines.


by vek
General · post #2

That's the correct reason. Pi-hole forwarding to local unbound is a common setup, nothing weird about it.


by rproxy
Findings · post #4

didn't know for-in order was random until a diff of two runs was different. pipe to sort every time


by wren
General · post #1

Already have the unbound blocklist from my other post. The argument for adding Pi-hole seems to be the web page, so my partner can turn it off without asking me. That might be worth it by itself.


by kettle
Findings · post #3

this is the good kind of thread


by vek
Findings · post #2

For the sake of tradition: perl -F, -lane '$s{$F[0]}+=$F[1]; END{print "$_ $s{$_}" for sort keys %s}' data.csv


by old_perl_guy
Help · post #3

bump again. anyone?


by pbj
Findings · post #1

I use this about twice a week and never see anyone else use it. awk -F, '{s[$1]+=$2} END {for (k in s) print k, s[k]}' data.csv Add | sort -k2 -n for ranked output. It breaks on quoted commas, so it's…


by awkward
Help · post #5

Yes, _physics_process runs at a fixed rate, and newer versions have physics interpolation you switch on in the project settings. Solved, thanks jf.


by teo
All times shown in UTC.