On Tue, Mar 15, 2005 at 10:58:09AM -0500, Chris Hammond wrote:
> Hi Craig, I am learning alot about databases here but can you point to 
> any documentation
> or give some pointers on where one would start to verify this?  I have 
> no idea where to
> even start to see if I am missing any indexes.
It strongly (obvious when you think about it) depends on what sort of
database you are running.
Postgresql it is dead easy, use the \di command to list indexes, and
\d <tablename> to list indexes for a table. marry up the lines in the
output to the create index commands in the .pgsql file

mysql it is with "show index from <tablename>", eg
show index from events;
+--------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table  | Non_unique | Key_name  | Seq_in_index | Column_name | Collation | 
Cardinality | Sub_part | Packed | Null | Index_type | Comment |

How to interpret is pretty hard.
Look at the list you are given, then look at the database definiton
file. At the bottom of each CREATE TABLE statement are lines beginning
with KEY, these are your indexes. For example the interfaces line has
  KEY interfacehost (interface,host),
  KEY last_poll_date (last_poll_date),
  KEY type (type),
  KEY check_status (check_status)
) TYPE=MyISAM;
near the end, showing 4 indexes being created (there are actually more,
I'm just showing the last few lines.)  Indexes across multiple columns,
like interfacehost, have 2 rows in the show index commands.

Tools like phpmyadmin great assist with the results, and are very good
for creating the new indexes.  With postgresql it is not as important
to use some sort of tool as it is easier for me at least.

  - Craig
-- 
Craig Small      GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
Eye-Net Consulting http://www.enc.com.au/   MIEE         Debian developer
csmall at : enc.com.au                      ieee.org           debian.org


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
jffnms-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jffnms-users

Reply via email to