database

SSH Tunnel for PostgreSQL Connection on AWS EC2

AWS has become a fairly ubiquitous hosting option for small companies.  But developers typically work on local dev setups outside the host and occasionally need access to the main dev and staging databases located on AWS.  How do you do this and still run in a secure environment?  One thing you don’t do is poke a hole in AWS‘ firewall and run PostgreSQL’s port

481 total views, 2 views today

Read More »

Optimizing a Result Set Pager

It’s ubiquitous on data driven web sites: the result set pager.  We’ve all used them whether we built them from scratch or used one provided by the framework. Pagers are by nature performance suckers because we’re asking the database to re-run the same query for each “page”, slicing off just one set of contiguous rows

384 total views, 1 views today

Read More »

Database Meets Revision Control

Any developer who has worked with HIPAA compliancy knows that the law is murky at best and the fed doesn’t publish a programmers’ guide to make your life any easier.  However, one of the cardinal rules is the requirement to keep track of who sees HIPAA data, who modifies it and when this was done. 

319 total views, 1 views today

Read More »

Finding duplicate records in a database: the SQL HAVING clause

One issue I run across occasionally is a table with duplicate entries such as two entries for the same company in an accounts payable system.  This can create embarrassing problems with billing if ACME Inc #1 is 90 days overdue because someone posted a payment, and now a credit, to ACME Inc #2. I ran

244 total views, 1 views today

Read More »

Returning latest/highest record from a set of records

A common reporting requirement in database applications is selecting the latest purchase, or latest job, or oldest chlld for each person in a table.  Any beginning student of SQL knows how to return the most recent date in a table: SELECT MAX(rec_date) FROM sales; max ——————————- 2011-03-15 18:04:45.178057-04 (1 row) But that doesn’t tell us

262 total views, no views today

Read More »
Scroll to Top