python - postgresql 10 on FreeBSD sporadically returns incorrect float values running the exact same query
问题描述
We've been running postgresql server 9.6 on FreeBSD 11.2 so far and tried to upgrade to version 10.4 last month. This week we tried again to upgrade to 10.5 hoping the issue might be solved.
After the upgrade, we experience the following behavior running this select query:
SELECT assets_daily.close
FROM assets_daily
INNER JOIN assets_daily_conditions ON (assets_daily.id = assets_daily_conditions.daily_id)
WHERE (assets_daily.asset_id = 139 AND assets_daily_conditions.condition_id = 117 AND assets_daily.close_diff_10 IS NOT NULL)
ORDER BY assets_daily.date DESC
Using either python libraries or just using the psql command client tool that comes with postgresql we will sporadically get different assets_daily.close values. So instead of the correct value, 10.8
we would get 0
or even more strange >.8
Running the same query again and again, this happens about every 10000 runs. Sometimes right after 50, sometimes after 20000 or even more. So it's very sporadic.
Here's some more information: assets_daily.close is a float8 field. The tables are not small (assets_daily has 8 million records, assets_daily_conditions about 45 million records). There are no other clients or processes running that are accessing the database at the same time. We updated FreeBSD to the latest 11.2R and tried both installing postgresql-server10 using the binary and the ports versions. The server logs show no errors and there's plenty of free memory.
We first tried to upgrade using pg_upgrade but after we got the errors also tried to pg_dump from 9.6 and re-import from scratch into 10.5. Same results.
I know this is hard/impossible to reproduce unless we provide a really detailed example with a dataset etc. But my hope is that maybe someone out there has similar issues and maybe even a solution or has some hints/ideas in what direction we could start looking for one.
解决方案
推荐阅读
- ios - NSURLSession Error Domain=NSPOSIXErrorDomain Code=28 "No space left on device"
- openlayers - Openlayers - ArcGIS Vector tiles - OFFSET
- react-native - Multiple Item Objects In Redux Store
- cross-compiling - 编译到 RISCV 架构时出现未定义的引用错误
- android - 对话框中的 ActivityResultLaucher:java.lang.RuntimeException:传递结果 ResultInfo 失败
- sql - 为什么在 mdb 中搜索 unicode 文本时会抛出 OleDbException?如何搜索 unicode 文本?
- linux - 拆分排序文件而不切割块
- python - Apple 使用 rest-social-auth Python 库的 Redirect_uri 问题
- firebase - 尝试从 Firebase FireStore 文档中检索数据时出错
- docker - Docker 离线时的 GCP 日志