Index not being used

2010-03-05 Thread Simon Kimber
Hi Everyone, I have the following table: CREATE TABLE `form_fields_items` ( `ID` int(11) NOT NULL auto_increment, `siteid` int(11) NOT NULL default '0', `fieldid` int(11) NOT NULL default '0', `value` varchar(150) NOT NULL default '', `sortorder` int(11) NOT NULL default '0', PRIMAR

Simple join very slow

2009-08-20 Thread Simon Kimber
Hi Everyone, Can anyone suggest why the following query is taking upwards of 5 seconds to run? SELECT * FROM users JOIN sites ON users.ID = sites.userid WHERE users.username = 'user1234' OR users.email = 't...@test.com' OR sites.email = 't...@test.com' The users table has an index on the us

Simple query slow on large table

2009-08-18 Thread Simon Kimber
Hi Everyone, I'm having a very simple query often take several seconds to run and would be hugely grateful for any advice on how i might spped this up. The table contains around 500k rows and the structure is as follows: +---+--+--+-+---+---

Trying to work out why a join query is so slow

2009-02-01 Thread Simon Kimber
Hi Everyone, I'm trying to run a very simple query on two joined tables but it's taking a long time to run. I have two tables, users and sites, both of which have an email address field that I'm querying. here's my query: SELECT * FROM sites INNER JOIN users ON sites.userid = users.ID