Jump to content

Accessing my Table via Index


moonbeachx

Recommended Posts


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 Foo2

Now 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!
Link to comment
Share on other sites

"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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.