Created
July 7, 2026 09:43
-
-
Save up1/153ad8031041a04fd4f00754241dd724 to your computer and use it in GitHub Desktop.
PostgreSQL :: table !!
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. View CacheMemoryContext --- | |
| SELECT pg_size_pretty(total_bytes) | |
| FROM pg_get_backend_memory_contexts() | |
| WHERE name = 'CacheMemoryContext'; | |
| ผลการทำงาน | |
| 1024 kB | |
| --- 2. Select from all tables in database | |
| DO | |
| $$DECLARE | |
| i integer; | |
| BEGIN | |
| FOR i IN 1..1000 LOOP | |
| EXECUTE | |
| format( | |
| 'TABLE %I', | |
| 'tab_' || i | |
| ); | |
| IF i % 10 = 0 THEN | |
| COMMIT; | |
| END IF; | |
| END LOOP; | |
| END;$$; | |
| --- 3. View CacheMemoryContext Again !! --- | |
| SELECT pg_size_pretty(total_bytes) | |
| FROM pg_get_backend_memory_contexts() | |
| WHERE name = 'CacheMemoryContext'; | |
| ผลการทำงาน | |
| 16 MB |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment