Giter Club home page Giter Club logo

Comments (2)

houstonhaynes avatar houstonhaynes commented on September 17, 2024

Well I just tried rebuilding the foreign table set after mapping both users to the server.

I got some interesting results - including a return of data in JetBrains Rider that looked like the data was coming back but then the postgres instance gave an error back a few seconds after the data was returned in the SQL Console view.

[2024-09-09 12:13:08] Connected
medptd.public> set search_path = "public"
[2024-09-09 12:13:09] completed in 72 ms
medptd.public> SELECT
                   EXTRACT(Year FROM Year) as Year,
                   ROUND(AVG(Total_Drug_Cost_Per_Day), 2) as Avg_Total_Drug_Cost_Per_Day,
                   ROUND(AVG(Over_65_Total_Drug_Cost_Per_Day), 2) as Over_65_Avg_Total_Drug_Cost_Per_Day
               FROM
                   cms_view
               WHERE
                   EXTRACT(Year FROM Year) = 2017
               GROUP BY
                   YEAR,
                   Total_Drug_Cost_Per_Day,
                   Over_65_Total_Drug_Cost_Per_Day
               ORDER BY AVG_Total_Drug_Cost_Per_Day DESC
[2024-09-09 12:14:13] An I/O error occurred while sending to the backend.
[2024-09-09 12:14:13] Unrecoverable error received, the connection is spoiled

image

Here's what the tail on the log has to say

postgres@cmspsql:~$ sudo tail -f /var/log/postgresql/postgresql-16-main.log
2024-09-09 16:14:15.665 UTC [5212] LOG:  terminating any other active server processes
2024-09-09 16:14:15.716 UTC [5212] LOG:  all server processes terminated; reinitializing
2024-09-09 16:14:15.730 UTC [5317] LOG:  database system was interrupted; last known up at 2024-09-09 16:12:47 UTC
2024-09-09 16:14:15.764 UTC [5317] LOG:  database system was not properly shut down; automatic recovery in progress
2024-09-09 16:14:15.767 UTC [5317] LOG:  redo starts at 0/1F071F0
2024-09-09 16:14:15.767 UTC [5317] LOG:  invalid record length at 0/1F07250: expected at least 24, got 0
2024-09-09 16:14:15.767 UTC [5317] LOG:  redo done at 0/1F07218 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s
2024-09-09 16:14:15.770 UTC [5318] LOG:  checkpoint starting: end-of-recovery immediate wait
2024-09-09 16:14:15.779 UTC [5318] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.003 s, sync=0.001 s, total=0.011 s; sync files=2, longest=0.001 s, average=0.001 s; distance=0 kB, estimate=0 kB; lsn=0/1F07250, redo lsn=0/1F07250
2024-09-09 16:14:15.783 UTC [5212] LOG:  database system is ready to accept connections
2024-09-09 16:19:10.204 UTC [5347] postgres@medptd ERROR:  failed to open SQLite DB. rc=1 path=/home/postgres/medptd.db
2024-09-09 16:19:10.204 UTC [5347] postgres@medptd STATEMENT:  SELECT
            EXTRACT(Year FROM Year) as Year,
            ROUND(AVG(Total_Drug_Cost_Per_Day), 2) as Avg_Total_Drug_Cost_Per_Day,
            ROUND(AVG(Over_65_Total_Drug_Cost_Per_Day), 2) as Over_65_Avg_Total_Drug_Cost_Per_Day
        FROM
            cms_view
        WHERE
            EXTRACT(Year FROM Year) = 2017
        GROUP BY
            YEAR,
            Total_Drug_Cost_Per_Day,
            Over_65_Total_Drug_Cost_Per_Day
        ORDER BY AVG_Total_Drug_Cost_Per_Day DESC

[tail still active and not further info when sending other queries]

The good news is that when I restart the server and query for row counts on the main view from either user the queries return a good value,.

postgres@cmspsql:~$ psql -d medptd;
psql (16.4 (Debian 16.4-1.pgdg120+1))
Type "help" for help.

medptd=# SELECT COUNT(*) from cms_view;
   count
-----------
 249489396
(1 row)

medptd=# exit
postgres@cmspsql:~$ su - cmsadmin
Password:
cmsadmin@cmspsql:~$ psql -d medptd
psql (16.4 (Debian 16.4-1.pgdg120+1))
Type "help" for help.

medptd=# SELECT COUNT(*) FROM cms_view;
   count
-----------
 249489396
(1 row)

image

HOWEVER when running a query that has some calculations in it postgres hangs.

medptd=# SELECT
    EXTRACT(Year FROM Year) as Year,
    ROUND(AVG(Total_Drug_Cost_Per_Day), 2) as Avg_Total_Drug_Cost_Per_Day,
    ROUND(AVG(Over_65_Total_Drug_Cost_Per_Day), 2) as Over_65_Avg_Total_Drug_Cost_Per_Day
FROM
    cms_view
WHERE
    EXTRACT(Year FROM Year) = 2017
GROUP BY
    YEAR,
    Total_Drug_Cost_Per_Day,
    Over_65_Total_Drug_Cost_Per_Day
ORDER BY AVG_Total_Drug_Cost_Per_Day DESC;
ERROR:  failed to open SQLite DB. rc=1 path=/home/postgres/medptd.db

from duckdb_fdw.

houstonhaynes avatar houstonhaynes commented on September 17, 2024

And just to round out the picture - the same "single view" query with aggregates runs without issue against the view in the DuckDB CLI.

Screenshot 2024-09-09 124521

Screenshot 2024-09-09 124408

from duckdb_fdw.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.