moonbeachx Posted February 13, 2006 Share Posted February 13, 2006 Hi,I am a newbie to PHP database programming. I have spent all day looking for a way to speed up a query that is over a table with 6 million (and counting) rows.Indexes seem like the way to go, so I created an index over my table. The table is Foo1 and the index is Foo2Now in my PHP Select statement do I just substitude Foo2 everywhere I had Foo1? I did so, and it gave me lots of errors:"Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/voletus/public_html/pages/property_poss17g.php on line 55".Help! Quote Link to comment https://forums.phpfreaks.com/topic/3401-accessing-my-table-via-index/ Share on other sites More sharing options...
fenway Posted February 13, 2006 Share Posted February 13, 2006 "Index over my table?" No, I think you're a bit confused. Your table name doesn't change, so keep foo1 in your queries, otherwise all hell will break loose. Second, I don't know what you mean by "the index is foo2" -- sure, you could give it that name, but the name is totally irrelevant, as you (almost) never need to use it. A proper index will be automagically picked by the mysql optimizer during parsing.What kind of index did you add? What type of queries are running slowly? What's the table structure? What type of read/write operations are being performed on this table? These are the types of questions we'll need answers to in order to help.But at its simplest, adding an index to a table doesn't change the syntactic nature of the query that it (possibly) affects.Hope that makes sense -- post back with the answers to the above questions, and we'll take it from there. Quote Link to comment https://forums.phpfreaks.com/topic/3401-accessing-my-table-via-index/#findComment-11637 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.