I'm not sure if an index would help me or not in this case.. and not
sure how to set one at creation. So I'll explain it all

My main select is 
select * from on_db where time>$t_tim ORDER BY place DESC

I also run the query
select * from on_db where time>$t_tim AND place='thisplace'

$t_tim is the current unix time -5 mins

the updates are simply
update on_db set time='$time',place='$place' where person='$person';

as you can see by the table below 'person' is the primary key so is
indexed
this table is updated nearly every second and 'time' is the unix time
input so is very possible to get same results so cannot make that unique
nor 'place' unique.. 

mysql> describe on_db;
+--------+----------+------+-----+---------+-------+
| Field  | Type     | Null | Key | Default | Extra |
+--------+----------+------+-----+---------+-------+
| person | char(50) |      | PRI |         |       |
| time   | int(20)  |      |     | 0       |       |
| place  | char(50) |      |     |         |       |
+--------+----------+------+-----+---------+-------+
3 rows in set (0.02 sec)

this is the command i used to create the table;

CREATE TABLE on_db (
  person char(50) DEFAULT '' NOT NULL,
  time int(20) DEFAULT '0' NOT NULL,
  place char(50) DEFAULT '' NOT NULL,
  PRIMARY KEY (handle),
  UNIQUE id (handle)
);

what would be the syntax used to create indexes for time and place at
table creation?
I looked through the docs but it seemed a bit confussing and since this
is a production system i didnt want to just guess.

Also, will the index help or hurt since the time and place keys are
updated constantly
is there and advantage or do you think it would be a waste of time. The
table itself usually ends up with around 15,000 entries which constantly
update based on the person and the time and place they are. 

any thoughts are welcomed.

--------------------------------------------------
Sign up for your free AngelHaven E-mail Today...
Join the growing community, http://www.AngelHaven.com 
Come Cruisin with the Angels http://www.AngelCruise.com

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to