db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Burton <burtona...@gmail.com>
Subject Torque features I've added in a forked tree... Merge into main?
Date Thu, 18 Aug 2005 22:54:41 GMT

I've been working on a forked version of Torque for a while now. 
Probably around two years.  I didn't intend for it to get THIS bad but
it has.  The main problem was I was sooo busy working on my main app
that I never had a chance to contribute back the changes.

Anyway.  I'm starting to work on some new projects and figured this
was a good enough time as any to correct this problem.

I'm going to try to dig into the Torque sources to see about the
current status but I thought I'd post a list of the features I've
added.  I still have to review my code but I think this is pretty much

• prejoin support and the prejoin API.  This allows you to fetch all
the object references for a list of objects at once.  For MySQL (and I
assume other databases) this has a significant performance advantage. 
Every SQL call costs about 1ms so for a list of 1000 items this can
save 999ms.
• support for prepared statements (which are MUCH faster in MySQL)
• when performing an UPDATE/INSERT only send columns that have been modified
• client-side join for IN clauses by specifying a List of BaseObjects
which have their getId() method called.
• lazy result set processing.  For example if you have a table with
10000 columns and you only call getColumnA() then we don't have to
fetch the remaining columns.  This has a HUGE performance advantage at
• New database connection pool called BDCP which is simple to
debug/understand, FAST, and reliable.  We had countless problems with
• save() should update the identity of the object with ID that was
generated on the server.
• BETA support for memcached. This means you can call retrieveById and
the prejoin API and have the results come from memcache and NOT from a
SQL box.  This should theoretically be much faster but I'm still
working on it.  The results were actually 4x slower but I'm optimistic
that I can have this fixed.
• REPLACE support for MySQL
• Support for working in MASTER/SLAVE environments when working with
MySQL.  save() and doUpdate, doInsert, etc work on a dedicated
connection to the master while SELECTs perform on another dedicated
connection. The SLAVE connection could also be used with a load
balancer if necessary.
• doSelectFirstRecord which returns the object type instead of just
Object when you know there will only ever be one result.  This is just
syntactic sugar and prevents casting.
• Support for a HashList mechanism where I can take a left join and
make it into a Map where the keys are the left most column and the
values are a list of all the items in that key.  This really helps for
tree structures since SQL can't return hierarchical structures. This
mechansim only supports on level of nesting right now.
• doSelectAsHashMap which can take a column, and a query, and return
the result as a HashMap instead of just a regular List.

 Kevin A. Burton, Location - San Francisco, CA
      AIM/YIM - sfburtonator,  Web - http://www.feedblog.org/
GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412
View raw message