MySQL Forums
Forum List  »  Optimizer & Parser

Query speed and columns per table
Posted by: Malcolm Wardlaw
Date: May 18, 2009 04:43PM

I have a question regarding the speed of select statements given the number of columns in the table. When I select say, six columns, "SELECT var1, var2,var3,var4,var5,var6 FROM table" from a table the speed of the query seems to scale linearly with the total number of variables in the table.

So querying a table with 1450 variables (around a million rows) took 210 seconds. The same query, selecting ONLY the same 6 variables again, selecting from the same table truncated to 280 variables took 40 seconds. The same table truncated to 100 variables took 17 seconds. This is all a linear increase in time of around .14 seconds per variable. That is variables in the table, not variables being queried, of which there is always only 6. The same table truncated at 10 variables takes 4.4 seconds, so it doesn't scale all the way down to 10 columns.

Why is this exactly? It seems oddly unnecessary. I've got around 4500 total unique columns in my whole database schema, which need to be separated in some logical form and joined together in pieces, and I'm trying to figure out how to optimize this. Breaking it down into 90 tables seems awfully impractical and would necessitate a data dictionary that defies any sensible logic.

Options: ReplyQuote


Subject
Views
Written By
Posted
Query speed and columns per table
3850
May 18, 2009 04:43PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.