first and final commit

This commit is contained in:
Regina Obe
2026-01-02 10:36:21 -05:00
commit 5c6bcdf190
17 changed files with 111437 additions and 0 deletions

11
ch03/DEC_10_SF1_QTH1.txt Normal file
View File

@@ -0,0 +1,11 @@
QT-H1
General Housing Characteristics: 2010
NOTE: For information on confidentiality protection, nonsampling error, and definitions, see http://www.census.gov/prod/cen2010/doc/sf1.pdf.
X Not applicable.
Source: U.S. Census Bureau, 2010 Census.
Summary File 1, Tables H3, H4, H5, and HCT1.

File diff suppressed because one or more lines are too long

3
ch03/README.txt Normal file
View File

@@ -0,0 +1,3 @@
Data was downloaded from factfinder2.census.gov
psqlrc.conf is an example psqlrc startup script.
If you are on a Unix environment rename to .psqlrc and place in your home directory.

8
ch03/build_stage.psql Normal file
View File

@@ -0,0 +1,8 @@
\a
\t
SELECT 'CREATE TABLE staging.factfinder_import(geo_id varchar(255)
, geo_id2 varchar(255), geo_display varchar(255)
, '|| array_to_string(array_agg('s' || lpad(i::text,2, '0')
|| ' varchar(255), s' || lpad(i::text,2, '0') || '_perc varchar(255) ' ), ',') || ');' As create_sql
FROM generate_series(1,51) As i \g create_script.sql
\i create_script.sql

9
ch03/psqlrc.conf Normal file
View File

@@ -0,0 +1,9 @@
\pset pager always
\pset null 'NULL'
\encoding latin1
\set PROMPT1 '%n@%M:%>%x %/# '
\set PROMPT2 ''
\timing on
\set qstats91 'SELECT usename, datname, substring(current_query, 1,100) || ''...'' As query FROM pg_stat_activity WHERE current_query != ''<IDLE>'';'
\set qstats92 'SELECT usename, datname, left(query,100) || ''...'' As query FROM pg_stat_activity WHERE state != ''idle'' ;'
\pset pager always

24
ch03/settings_report.psql Normal file
View File

@@ -0,0 +1,24 @@
\o settings_report.html
\T 'cellspacing=0 cellpadding=0'
\qecho '<html><head><style>H2{color:maroon}</style>'
\qecho '<title>PostgreSQL Settings</title></head><body>'
\qecho '<table><tr valign=''top''><td><h2>Planner Settings</h2>'
\x on
\t on
\pset format html
SELECT category, string_agg(name || '=' || setting, E'\n' ORDER BY name) As settings
FROM pg_settings
WHERE category LIKE '%Planner%' GROUP BY category ORDER BY category;
\H
\qecho '</td><td><h2>File Locations</h2>'
\x off
\t on
\pset format html
SELECT name, setting
FROM pg_settings
WHERE category = 'File Locations' ORDER BY name;
\qecho '<h2>Memory Settings</h2>'
SELECT name, setting, unit
FROM pg_settings WHERE category ILIKE '%memory%' ORDER BY name;
\qecho '</td></tr></table>'
\qecho '</body></html>'