Why is my query returning varying results, and how do I go about troubleshooting this issue?

53 Views Asked by At

When I run a simple count(*) using dbplyr, I get anywhere from 40k to 70k at a result:

> tbl(con,sql("select count(*) from app_public.members"))
# Source:   SQL [1 x 1]
# Database: postgres ...
    count
  <int64>
1   62859
> tbl(con,sql("select count(*) from app_public.members"))
# Source:   SQL [1 x 1]
# Database: postgres ...
    count
  <int64>
1   54141

This takes less than a second to run, so I don't think it is a time-out issue. When I run this on my database (via DataGrip), the answer is consistently 108646. I confirmed I have the same connection host, port, dbname, and username/password.

The table type of my_schema.members is "BASE TABLE", and based on the information_schema, there are no tables named the same. As far as I can tell, this is the only table that acts this way.

What could be happening? How do I help my IT department troubleshoot?

0

There are 0 best solutions below