Without any other details it seems simple, just create indexes on any join or where column, setup a slave box for data warehousing purposes, run the simple SQL
On Mon, Jun 21, 2010 at 11:09 PM, der.hans <[email protected]> wrote: > moin moin, > > t1: t1id, varchar1, stuff > t2: t2id, timestamp, varchar1, varchar2, status > > I need to match the most recently entered status from t2 with stuff from > t1 in MySQL. > > t2 is grouped by varchar2. > > t1 will have millions of rows. t2 has millions of rows and will grow at 4 > or 5 times the rate of t1. t2.varchar1 will often be NULL. Non-NULL values > will mostly match up with t1.varchar1. t1.varchar1 can not be NULL. > varchar2 is a clustering of information about varchar1, but usually only > one entry in the cluster will have a value for varchar1. > > t1.stuff, t2.status == $some_val where max(t2.timestamp) and t1.varchar1 > == t2.varchar1 and t2.varchar2 == t2.varchar2 > > This is for reporting and will run on a slave. > > Any suggestions on how to efficiently build out the report? Unlike my last > DB job, I can create indexes, views, etc. > > I can also add columns to either table. > > ciao, > > der.hans > -- > # http://www.LuftHans.com/Classes http://www.TwoGeekTechs.com/ > # Director of Engineering, FonWallet Transaction Solutions, Inc. > # If you're not learning, you're not living. - der.hans > --------------------------------------------------- > PLUG-discuss mailing list - [email protected] > To subscribe, unsubscribe, or to change your mail settings: > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss > --------------------------------------------------- PLUG-discuss mailing list - [email protected] To subscribe, unsubscribe, or to change your mail settings: http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
