I am writing a custom fdw that uses a program to pull data from a database. The database has ~30 columns and ~8,000,000 rows. The program accepts filtering based on columns and quals (my fdw passes on both). I am noticing that selecting 1 column of data from the wrapper is 12x slower than from the program it calls, but if I define a different foreign table with only that 1 column, the sql call speeds up 10x. Does anyone have any idea why this would be the case?
I am writing a custom fdw that uses a program to pull data from a database. The database has ~30 columns and ~8,000,000 rows. The program accepts filtering based on columns and quals (my fdw passes on both). I am noticing that selecting 1 column of data from the wrapper is 12x slower than from the program it calls, but if I define a different foreign table with only that 1 column, the sql call speeds up 10x. Does anyone have any idea why this would be the case?