17 May, 2013

Fiat 500

by gorthx

Last year I started a job as a consultant. Of course, this means traveling a bit. I rent cars from Enterprise a lot, and am a member of their “Enterprise Plus” club. I’ve racked up a lot of points, but haven’t actually tried to redeem them yet; as of yet the only advantage to being a Plus member is getting to go to the head of the line at the rental counter. Which I always feel guilty about.

I almost always get a compact or “econobox” and occasionally get upgraded. The conversation usually goes like this: they ask if I have a preference of vehicles 1, and I say “I don’t really care, just as long as it’s not a Nissan Versa”2, and then we pick something out. This week the sales associate said “Well, what about this Fiat?” and stopped next to this cute little red thing. Uh sure, twist my arm!

Car: Fiat 500, fire-engine red.

Fuel economy: Meh. Manufacturer claims 34-40 highway, I got on the low end of that3.

Handling: The tight turning radius is a big plus; I could flip a U on a two-lane road. It got a bit squirrelly at high speeds, though.

Conversation starter: A+. People wanted to chat at stoplights, or while they were turning through an intersection (!!!), and one time, I came out of the grocery store to find someone waiting by the car because he wanted to ask me about it.

Appearance: Cute, but not as cute as a Mini Countryman. The red is a really nice deep red, though.

Comfort: Very! 3 hours straight and no back pain or tingly feet. The back seat is probably limited to children or very small people, though I imagine it’s motion-sicknessville back there. Bonus: I could drive with one window down without that annoying air thumping, up to about 75mph.

Trunk space: What?

Annoyances, allow me to list them:
1. The dashboard layout. Seriously: who designed this?! The automatic windows are controlled by two separate switches, and you have to reach over the gearshift to work the passenger side window. May as well have manual cranks if you’re going to do that. (In this car, the distance isn’t that much farther.)

2. No auto-up on the windows. See “reacharound” above.

3. Despite the additional fisheye mirror, you could hide a minivan in the driver’s side blind spot.

4. Can’t pop the hatchback from in the car. Or maybe you can, but I never found the lever (see comment about dashboard layout above.). You have to hit the button on the key, then manually open the door. Then, the door doesn’t have a handle or anything to grab to pull it down, just a little teeny strap.

Moment of hilarity: Driving along Illinois 288 and hitting the perfect frequency on the concrete seams to make the car bounce so much I thought it might take off. I laughed so hard I almost had to pull over.

If I bought this car, the first thing I would do is replace the stock tires with something that grips a bit better; it was kinda scary in some of the turns.



1 – So far my favorite car is the Toyota Yaris. (I know, I’m surprised too!)
2 – The less said about that travesty of a vehicle, the better. Bleah.
3 – For reference, my personal car is a TDI Beetle. I get 50-60mpg on the highway, if I don’t have bikes on the top; then I get 40-45. So compared to that, everything else is going to be “meh” or worse.

12 April, 2013

Followup to some questions about the Postgres activity log

by gorthx

Answers to three questions that have come up from my various logging & monitoring talks over the years:

1. I recommend putting your activity logs on their own partition, just like you would with the transaction logs and your data directory. Rob W asked “What happens when the logger runs out of space?” The answer: nothing drastic. Postgres won’t write any more log entries, but the database will stay up. Make sure you have appropriate monitoring in place to alert you if that partition fills up.

2. “Can you set multiple log_destinations?” Well, I’ve logged to csv + stderr and csv + eventlog, just to see if it could be done. I don’t know what would happen if you tried csv + syslog.

3. “Can you set the logging GUCs on a per-database level?” Yes, some of them can be set to different values per-database or per-user, even. This can be quite useful to answer, for example, the “I don’t think your application is sending the SQL statements you think it’s sending” type of questions:

– for a specific database:
ALTER DATABASE tedsdb SET log_statement = 'all';
– for a specific user:
ALTER ROLE bill SET log_statement = 'all';

To undo this change:
ALTER ROLE bill SET log_statement = default;
or
ALTER ROLE bill RESET log_statement;

To check the settings for the database, join pg_db_role_setting, pg_database, and pg_authid:
postgres=# SELECT d.datname, COALESCE(r.rolname, 'ALL') AS rolname, s.setconfig
FROM pg_database d
JOIN pg_db_role_setting s
ON s.setdatabase = d.oid
LEFT JOIN pg_authid r
ON s.setrole = r.oid;
datname | rolname | setconfig
---------+---------+---------------------
tedsdb | ALL | {log_statement=all}

To check the settings for a particular user, look in pg_roles:
postgres=# SELECT rolname, rolconfig
FROM pg_roles
ORDER BY rolname;
rolname | rolconfig
----------+---------------------
bill | {log_statement=all}
postgres |

5 April, 2013

Installing PostgreSQL (and friends) from source on Ubuntu 12.04 (Precise Pangolin)

by gorthx

This is an update to this post from a few years back. This time I’m installing Postgres 9.2.3, PostGIS 2.0.1, and pgAdmin 1.17.0 on Ubuntu 12.04.
read more »

22 March, 2013

Monitoring tools: nmon

by gorthx

Next up in my occasional monitoring tools review series: another oldie-but-goodie, readily available tool, nmon.

What: nmon
What it monitors: system stats
Where to get it: it’s probably pre-installed on your system. If not, get it from sourceforge.
Why you’d want (or not) to use it: Pretty much the same reasons you’d want to use sar, as I discussed previously.

I’ve (casually) used the interactive interface, and until a few weeks ago, thought that’s all that there was to this tool. Not so. There’s an option (-f) you can use to save a single data poll to a file, in “spreadsheet format”. You can also specify an interval and a number of polls to take:

nmon -f -s 60 -c 60
= poll once a minute for an hour.

nmon will create a file for you, with a default name of [server]-timestamp.nmon, or you can specify your own filename with -F.

To generate graphs, there are two Excel spreadsheets you can download from the wiki. I tried the nmon Analyzer Spreadsheet (the newer of the two). The docs recommend “keep the number of snapshots to around 300″. I agree. The graphs look a lot nicer with fewer data points in them. However, Excel graphs just aren’t as pretty as rrdtool graphs.

There’s an nmon2rrd tool, but it was compiled for AIX so I didn’t try it out.

Of the two, if I’m looking for on-the-spot visualization of system performance, nmon wins it. For storage and later review of the data, I’d go with sar + sar2rrd.pl over nmon + the Excel spreadsheet. The graphs are prettier and easier to read with sar.

Tags: ,
15 March, 2013

Monitoring Tools: sar

by gorthx

What: sar
What it monitors: pretty much every system stat you can imagine (and some you haven’t)
Where to get it: it’s probably pre-installed on your system; if not, try the sysstats package (the same one that includes iostats)
Why you’d want to use it:

  • you need an answer fast, but maybe don’t have access to the “enterprise” monitoring (or there isn’t any…[1])
  • you’re doing system testing and want a command-line tool that’s easy to configure and run in discrete timeframes.

Why you wouldn’t want to use it:

  • you want data you can easily throw into a graphing or analysis program; the data produced by sar isn’t readily machine-readable
  • you’re looking for a near-real-time long-term monitoring solution. In that case, just go ahead and set up munin or collectd.

Because it’s lightweight and so readily available, it’s a good tool to have in your toolbox. Plus, it’ll tell you things like fan speed and temperature, and I’m just a sucker for environmental monitoring [2].
read more »

8 March, 2013

Updating My Linux Command line Toolbox

by gorthx

Over the past few months I’ve been working with some people with many more years of unix-y experience than I have. They’ve been teaching me new stuff, and showing me updated versions of commands I’ve been using in sometimes kludgy ways. Here are 10 examples.

1. join, which feels kind of like a stoneage tool; it’s not that versatile, and I’m sure there are perl one-liners that could do the same thing. But join’s readily available and it’s a fast way to join two files, if they meet the requirements: same file separator, a “key” field (which is easy to add with nl, #2 below), etc.

2. nl to number the lines in a file.

My most-used switches:
nl -v 800 -w 3 -n rn -s, oldfile > newfile
-v = start with this number
-w = number of characters (in this example, numbers > 999 will be truncated)
-n rn = ‘right justified, no 0 padding’ so you don’t have to go back through another round of text processing to strip them off
-s, = use a comma as a field sep

3. truncate as a desperate move to free up some space. Bonus: do this on a log file to confuse your coworkers.

4. watch [1]
Current favorite:
watch -n 10 “psql -d my_db -c \”SELECT datname, procpid, usename, backend_start, xact_start, query_start, waiting, current_query FROM pg_stat_activity WHERE current_query LIKE ‘autovacuum:%’\”"

5. lastlog, last, and lastb
most recent login, all logins, and all bad logins

6. df -h instead of df -k
df -k was one of the first unix commands I learned. It used to be easy to read the blocks, Used, and Available columns (they had fewer digits back then). df -h makes it easy again, and shows me the units. The muscle memory on this one has been particularly hard to shed.

7. echo * | wc -w instead of ls | wc -l or ls -1 | wc -l
The first sysadmin I ever worked with taught me ls -1 | wc -l. Turns out you don’t need the -1 to list the files individually, if you are piping the output to another command.

Use echo * to quickly list the number of files in a directory, when that number is more than a few thousand; assumes no spaces in the filenames.

8. awk can be kind of intimidating due to its sheer power and uninformative error messages. I have a small cheatsheet I keep handy, for tasks I do frequently. These are the most recent additions:

To remove everything owned by me in a directory:
ls -l | awk ‘/gabrielle/{print $9}’ | xargs rm

To find all files > 0 size in a directory:
ls -l | awk ‘$5>0{print}’

9. Everything here: https://dougvitale.wordpress.com/2011/12/21/deprecated-linux-networking-commands-and-their-replacements/

10. And sar, which I’ll write a separate post about.

Thanks to Joe, Vibhor, Oscar, and of course MJM.

1 – “How did I not know about ‘watch’?” “You were using Solaris all these years, m’dear.”

Tags: ,
28 September, 2012

Nook Simple Touch: (almost) six-month review

by gorthx

So, I’ve had this thing for a few months now, and it turns out I’m using it way more than I thought I would. I love traveling with it – it beats the heck out of carrying a book around. I take it camping, too.

I made my own screensaver with a bunch of images I converted to greyscale in The GiMP.

I also use it to store my current knitting pattern; just export it to .pdf and load it on there!

Annoyances:
- the ‘home’ button (the little ‘n’ at the bottom) was already getting a bit beat up at the one-month mark, and I also scratched the screen pretty quickly, because I just threw it in my handbag without a cover. Don’t do that.
- powering it completely off and back on frequently (e.g., for the required “please fasten your seatbelts and extinguish all portable electronics”) seems to suck out the power.
- I can’t resize images in the books, at least I can’t figure out how to do it. This is a drag when I read books with photos or maps.

Finding books is still a problem. I don’t like purchasing a lot of books (even though they’re not physically on the shelves, it’s like I can feel the clutter) and the options through my library are not yet wonderful. library2go (aka Overdrive) still has a sucky website, and the .pdfs I get from ebrary don’t transfer to my nook correctly: all I get is the copyright page, over and over.

Other than that, :thumbsup: from me. Would purchase again.

Tags:
24 September, 2012

PgOpen Recap

by gorthx

Another year, another excellent conference. This go-round was even better than last year’s.

There were lots of new folks at the conference this year; welcome to the community!

I made it to most of the talks I’d planned to, and of course came away with lot of ideas for things I want to try at home, such as the examples from Jon Erdman’s lightning talk about pgdump -Fc.

My fave was Dimitri Fontaine’s Large Scale MySQL Migration, because I like the ‘war stories’. (I would not have been surprised if he’d said “…and then some alligators tried to eat us!”) Denish Patel’s lightning talk was hilarious, and I am looking forward to messing around with the pg_stat_plans extension Greg Smith & Peter Geoghegen discussed during Query Logging and Workload Analysis.

I was half-drafted/half-volunteered to be on the conference committee for next year. We’ll strive to uphold the fine level of conference to which you’ve become accustomed. (If you attended this year’s conference, don’t forget to fill out the survey!)


P.S. Thanks to Greg Smith for leveraging his frequent-flyer powers for good, and getting me on a different flight when I missed mine. This really shows the “community” part of the Postgres Community.

17 August, 2012

My Picks for Postgres Open 2012

by gorthx

The schedule for Postgres Open is out!

Here are the talks I’m planning on attending:
Tuesday:
Range Types in PostgreSQL 9.2 (Jonathan S Katz)

Large Scale MySQL Migration to PostgreSQL (Dimitri Fontaine) because I love case studies

12 Calm Years of PostgreSQL in Critical Messaging (John Scott) another case study

This is PostGIS (Paul Ramsey) <– 'nuff said

If I wasn't giving a talk at the same time, I’d be going to High Availability with PostgreSQL and Pacemaker (Sean M. Thomas)

Of course, I will be attending the Lightning Talks!

Wednesday:
Super Jumbo Deluxe (Josh Berkus)

For the next few sessions, I’ll require a coin toss to decide between:
Deploying Maximum HA (Denish Patel)
and
Scaling Postgres with some help from Redis (Josiah Carlson)

…and:
Query Logging and Workload Analysis (Greg Smith)
and
DVDStore Benchmark (Jignesh Shah)

The penultimate session is going to be tough to choose. Today I am leaning toward A Batch of Commit Batching (Paul Geoghegan)

To wrap it up, I want to hear about PG Extractor – A Smarter pg_dump (Keith Fiske)

I’m looking forward to the hallway track & meeting old & new friends. This was a really good conference last year & it’s not too late to register. Hope to see you there!

10 August, 2012

Speaking at Postgres Open

by gorthx

I’m speaking at Postgres Open again this year! I’ll be giving an updated version of my Intro to Logging talk.

Come by early registration (aka “pub registration”) Sunday evening and say hello.

Follow

Get every new post delivered to your Inbox.