On 6/21/05, Dan Bolser wrote: > > I am interested in the theoretical time / space complexity of SQL queries > on indexed / non-indexed data.
I doubt this is the right list for theory. > Specifically I want to know the complexity of a query that does a > 'cross tabulation' > > SELECT > X, > SUM(if(Y=1,Z,0)) AS s1, > SUM(if(Y=2,Z,0)) AS s2, > SUM(if(Y=3,Z,0)) AS s3, > ... > FROM > T1 > GROUP BY > X; > > Assuming both X and Y are indexed, how does the complexity grow with > increasing 's' (more if clauses). In MySQL: I bet the indexes don't matter and the complexity grows less then linear. The EXPLAIN output will tell you why. > Can anyone point me to a good online guide to complexity of SQL? The language SQL or some implementation? Consider looking at PostgreSQL instead of MySQL as your test system. I find the tools to look inside much better: http://www.mail-archive.com/pgsql-hackers@postgresql.org/msg17592.html Jochem -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]