News for hackers. Stuff that matters.
Re:Poll: What database does your company use? by statictype on Wednesday June 22, 2011 @09:58PM (#2686312)
The sarcasm was perhaps a little mean but he has a point. If a flat text file storing JSON could replace your database, then you probably never needed a DB in the first place.
Re:Poll: What database does your company use? by daleharvey on Wednesday June 22, 2011 @10:07PM (#2686330)
Lots of people use full blown rdbms's when they dont need to (see blogs), its not a silly point and the sarcasm was unwarranted
Re:Poll: What database does your company use? by alextingle on Thursday June 23, 2011 @09:34AM (#2687762)
Sarcasm is never unwarranted.
Re:Poll: What database does your company use? by code_duck on Thursday June 23, 2011 @12:01AM (#2686603)
If you can use SQLlite, you probably didn't need a real database. So the use cases overlap a bit with flat-files and JSON.
Re:Poll: What database does your company use? by mmaunder on Thursday June 23, 2011 @12:24AM (#2686649)
The JSON flat file sounds like variable length records where length is determined by parsing each record with global reader/writer locking?

It's like public storage where you have to sift through everyone else's crap to get to yours, every item is stored in a bulk cargo box and only one customer gets to store their stuff at a time.

If you're interested in db internals, here's a few algorithms that MySQL uses. Note this doesn't cover InnoDB which performs far better under high concurrency loads and offers row level locking, clustered indexes, an excellent caching algorithm, foreign key constraints with cascade, etc..etc...

http://forge.mysql.com/wiki/MySQL_Internals_Algorithms

Re:Poll: What database does your company use? by code_duck on Thursday June 23, 2011 @01:59AM (#2686844)
The way I've stored things in flat files is to make use of the file system's lookup capabilities. I wouldn't suggest storing data that may be requested or written to by more than one client at once with a method such as this, either. I wouldn't try to use it like a C array or anything. One file per user or more makes sense. I've also used stuff like this for system admin scripts.

Something like

   user_id=int(request.GET['id'])
   data_type=int(request.GET['id'])
   json_file="{0}-{1}-chart_data.json".format(user_id,data_type)
   #get the file, decode, etc.
It's a quick and dirty caching method that has good persistence, of course, is relatively performant under low loads and easy to understand.

Thanks, I'll check out the MySQL thing, but I'm not actually intending to build my own database.

Re:Poll: What database does your company use? by zem on Saturday June 25, 2011 @09:00AM (#2695562)
what's your cutoff line for something to be a "real database"? sqlite is fully acid compliant.
Re:Poll: What database does your company use? by code_duck on Sunday June 26, 2011 @11:14AM (#2698133)
sqlite is single user and locks a bit too frequently to be very scalable, so while quite useful, I mean sqlite not capable of fully replacing a typical engine such as postgres or mysql.