Last active
August 8, 2020 14:39
-
-
Save recurse-id/6107150 to your computer and use it in GitHub Desktop.
Some tips on creating pl/python functions in psql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) instead of returning SETOF composite_type or SETOF RECORD (OUT col type) return TABLE (col type,etc) and just yield. | |
2) For long queries in plpy.execute use triple quotes for multiline queries | |
3) use explain [query] to figure out what is taking so much time on a query then build indexes to remove the "sequential scans" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment