Skip to content

Conversation

Gilbert09
Copy link
Member

Problem

  • We're running TABLESAMPLE queries that aren't supported by views on postgres (only base tables and mat views)

Changes

  • Use a naive probabilistic sampling method instead - we achieve the same result, but its a bit more intensive on postgres

@Gilbert09 Gilbert09 requested a review from a team October 13, 2025 13:00
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

schema,
table_name,
should_use_incremental_field,
None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: passing None for table_type could cause issues if add_sampling=True is added later - view queries would incorrectly use TABLESAMPLE and fail

Suggested change
None,
table.type,
Prompt To Fix With AI
This is a comment left during a code review.
Path: posthog/temporal/data_imports/sources/postgres/postgres.py
Line: 729:729

Comment:
**logic:** passing `None` for `table_type` could cause issues if `add_sampling=True` is added later - view queries would incorrectly use `TABLESAMPLE` and fail

```suggestion
                        table.type,
```

How can I resolve this? If you propose a fix, please make it concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant