Databasen - Revisited

Toby Corkindale tjc at wintrmute.net
Wed Oct 18 17:56:13 BST 2006


On Wed, Oct 18, 2006 at 12:16:00PM -0400, Matt Sergeant wrote:
> On 18-Oct-06, at 11:08 AM, Nigel Rantor wrote:
> 
> >So, due to the excellent response to the first post regarding  
> >interviewing DB candidates and some of the weird and wonderful  
> >ideas they have I present my second, very open, question...
> >
> >What is your favourite question to guage someone's level of  
> >expertise in the database field generally, without reference to any  
> >specific DB.
> >
> >Have at it mongers...
> 
> Q: What is wrong with the following setup:
> 
> CREATE TABLE Month (
>   id INTEGER PRIMARY KEY,
>   name VARCHAR(16),
>   shortname VARCHAR(3)
> );
> 
> INSERT INTO Month VALUES (1, "January", "Jan");
> ...
> 
> There are lots of fairly obvious right answers (localisation would be  
> one obvious one), but most people won't get the fact that the primary  
> key index is a bad thing, because the entire table fits into a single  
> page of pretty much every DB I know, so index access is actually  
> slower than a full table scan.
> 
> If they answer with that, it's an instant hire (though I've never  
> given this question to anyone. 9 out of 10 DBAs wouldn't even get it,  
> sadly).

Although, since I know PostgreSQL will realise this and do the scanning query
accordingly, wouldn't it be wrong to ditch the primary key, as premature
optimisation?
(Although, somehow I don't see you adding more months to the table, but that's
very specific to this table)

tjc 

-- 
Turning and turning in the widening gyre/The falcon cannot hear the falconer;
Things fall apart, the centre cannot hold/Mere anarchy is loosed upon the world
(gpg --keyserver www.co.uk.pgp.net --recv-key B1CCF88E)


More information about the london.pm mailing list