Re: Testing for the existence of an index
On Tue, Aug 24, 2004 at 11:57:05AM +0200, Thomas Spahni wrote: Jesse, mysql SHOW INDEX FROM mytable; gives you all indexes for `mytable`; you can process the results with perl. Thanks very much. This works fine, and since I don't care about the return value--just that there is one--it becomes trivial. Jesse Sheidlower -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Testing for the existence of an index
Jesse, mysql SHOW INDEX FROM mytable; gives you all indexes for `mytable`; you can process the results with perl. Thomas Spahni On Mon, 23 Aug 2004, Jesse Sheidlower wrote: I have a database where, most of the time, I'm bulk-loading data into new tables from an external source, several million rows at a time. For this purpose, I create the tables without indexes, and then add all my indexes after the load is done, for efficiency purposes. I'd now like to add the possibility of adding some data to the existing database. In this case, the indexes exist, and then the new data will be indexed as it goes in (which is OK given the relatively small amount of data to be processed this way). I'd like to be able to test for the existence of an index, so that after the bulk-load, I can see if there are indexes, there won't be any, and I can create them; but after an addition to an existing database, there will be indexes, and I won't create them. How do I do this? It wasn't clear from the manual, and I'm away from my books now so can't look there for advice. I'm using Perl to process the data, if there's a Perlish way of doing things that would be easier than SQL. Jesse Sheidlower -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Testing for the existence of an index
Why don't you disable the indexes before the load and enable the indexes after the data load? -Original Message- From: Jesse Sheidlower To: [EMAIL PROTECTED] Sent: 8/23/04 3:33 PM Subject: Testing for the existence of an index I have a database where, most of the time, I'm bulk-loading data into new tables from an external source, several million rows at a time. For this purpose, I create the tables without indexes, and then add all my indexes after the load is done, for efficiency purposes. I'd now like to add the possibility of adding some data to the existing database. In this case, the indexes exist, and then the new data will be indexed as it goes in (which is OK given the relatively small amount of data to be processed this way). I'd like to be able to test for the existence of an index, so that after the bulk-load, I can see if there are indexes, there won't be any, and I can create them; but after an addition to an existing database, there will be indexes, and I won't create them. How do I do this? It wasn't clear from the manual, and I'm away from my books now so can't look there for advice. I'm using Perl to process the data, if there's a Perlish way of doing things that would be easier than SQL. Jesse Sheidlower -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Testing for the existence of an index
Why don't you download navicat or use php admin and then just open the table up in design view? You can then see if it has an index or not and add one if you need? -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Testing for the existence of an index
On Mon, Aug 23, 2004 at 03:45:28PM -0500, Victor Pendleton wrote: Why don't you disable the indexes before the load and enable the indexes after the data load? If I'm bulk-loading a fresh install of data, then I'll be using un-indexed tables and index them afterwards. Otherwise, I want to keep the indexes on the table, and index as I go along (so that when I'm done I don't have to re-index from scratch). In response to the other poster, who suggested opening the table up in some utility: it's not a problem for _me_ to determine if I'm bulk-loading a new batch, or adding to an existing database. I want my loading program to be able to determine this without any input from me. Thanks. Jesse Sheidlower -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]