How to export a table to a CSV file?

2005-05-05 Thread Homam S.A.
NOTE: I sent this message yesterday, but for some reason it didn't show up in the list. If you've already received it, I apologize for the inconvenience. So here it goes again: I searched the online manual and all I could find was a reference to a statement of the form: SELECT INTO

MyISAM and Dirty Reads

2005-04-13 Thread Homam S.A.
Is there a way to use dirty reads (that acquire no read locks on the table) with MyISAM tables? I want to avoid having the read requests queuing up while the table is updated, and I can tolerate a small margin of inconsistency for the sake of throughput. So far I found only information about

Re: VB.NET how to connect to MySQL 4.1 DB

2005-04-11 Thread Homam S.A.
Download the .NET connector for MySQL: http://dev.mysql.com/downloads/connector/net/1.0.html Reference it in your project and you're ready to go. It comes with plenty of code examples on how to use it. --- Winanjaya [EMAIL PROTECTED] wrote: Dear All, Any body has experience to connect

Writing a custom storage engine

2005-03-31 Thread Homam S.A.
I've been contemplating writing my own custom storage engine for MySQL. I haven't found much documentation on the subject besides these articles: http://netmirror.org/mirror/mysql.com/tech-resources/articles/creating-new-storage-engine.html

UNION, LIMIT, and FOUND_ROWS()

2005-03-28 Thread Homam S.A.
If I use the LIMIT clause without using SQL_CALC_FOUND_ROWS in a non-UNION statement, MySQL returns the number of rows found up to the LIMIT. Using SQL_CALC_FOUND_ROWS forces MySQL to keep going on checking all hits, and that affects performance. However, if I use the LIMIT clause at the end of a

Is there a way to use LIMIT in both UNION ALL statement and then ORDER?

2005-03-28 Thread Homam S.A.
MySQL seems to let me use the LIMIT clause in both parts of a UNION ALL query, but as soon as I add an ORDER BY CLAUSE, it gives me a syntax error. For example, this query executes fine: SELECT * FROM A WHERE X = 1 LIMIT 1000 UNION ALL SELECT * FROM B WHERE Y = 1 LIMIT 1000 But this returns an

Re: Is there a way to use LIMIT in both UNION ALL statement and then ORDER?

2005-03-28 Thread Homam S.A.
Nevermind, I found in the documentation that I need to paranthesize the SELECT parts of the UNION ALL, like this: (SELECT X, Y FROM A WHERE W = 1 LIMIT 1000) UNION ALL (SELECT X, Y FROM B WHERE W = 1 LIMIT 1000) ORDER BY X --- Homam S.A. [EMAIL PROTECTED] wrote: MySQL seems to let me use

Why doesn't MySQL cache queries that start with parenthesis?

2005-03-28 Thread Homam S.A.
I have a query of the form: (SELECT A, B from X ORDER BY A LIMIT 1000) UNION ALL (SELECT A, B from Y ORDER BY A LIMIT 1000) ORDER BY A I thought may be each query needs to start with SELECT, so I wrapped the above query in a derived-table expression like: SELECT * FROM ( (SELECT A, B from X

Why doesn't MySQL cache queries that start with parenthesis? (further info)

2005-03-28 Thread Homam S.A.
It seems that MySQL freaks out whenever it seems something that looks like a derive table and refuses it to cache. Even a non-UNION query like: SELECT * FROM (SELECT * FROM X WHERE A = 5) AS DerivedTable Won't be cached. I read a comment in the documentation that if you put SQL_CACHE in the

Re: Better option then polling ?

2005-03-11 Thread Homam S.A.
There's nothing wrong with polling as long as it's moderate and it doesn't lock resources. On a heavily updated table in a large volumen site, it scales much better than nasty triggers or events firing all over the place. Triggers are intended to maintain internal database consistency by

Re: Optimizing a big query...

2005-03-10 Thread Homam S.A.
--- mos [EMAIL PROTECTED] wrote: Correct, but the speed difference will more than make up for it. If you have a busy website, it is very important not to overtax the database server with frills, like the number of rows found. If you want to have the record counts, then you will have to

Re: Slow queries only the first time

2005-03-10 Thread Homam S.A.
Most likely it's the OS cache caching all those disk segments in memory. Also in InnoDB, MySQL uses the Buffer Pool Size to cache data pages in addition to the OS cache. If you're running ona Windows machine, you can easily tell what's going on by opening up Performance Monitor and watching

RE: CASE statement and version 4.1.x

2005-03-09 Thread Homam S.A.
as T-SQL with END and it worked fine. Homam --- Tom Crimmins [EMAIL PROTECTED] wrote: On Wednesday, March 09, 2005 07:49, Philippe Poelvoorde wrote: Daniel Kasak wrote: Homam S.A. wrote: In the documentation, it doesn't mention which version of MySQL supports the CASE statement

Forcing session variable definition

2005-03-09 Thread Homam S.A.
I just spent quite a while hunting out a bug that turned out to be a mis-spelled session variable defaulting to NULL. Ultimately what I want is, if I used a session veriable without defining it before hand with a SET, MySQL would return an error. Such problem doesn't exist in T-SQL, for example,

Forcing session variable definition (correction)

2005-03-09 Thread Homam S.A.
I'm sorry, I meant user variables, not session variables. --- Homam S.A. [EMAIL PROTECTED] wrote: I just spent quite a while hunting out a bug that turned out to be a mis-spelled session variable defaulting to NULL. Ultimately what I want is, if I used a session veriable without defining

Re: Optimizing a big query...

2005-03-09 Thread Homam S.A.
If your tables are mostly read-only, you could pre-generate page numbers on a periodic basis and select only specific ranges WHERE row_number BETWEEN page_start AND page_finish. Or you could just send the top 1000 IDs of the table to the client, and have the client figure out which IDs belong to

Re: Optimizing a big query...

2005-03-09 Thread Homam S.A.
Unfortunately this doesn't work well if you want to tell your users how many pages were found in the query. Sure, you could use SQL_CALC_FOUND_ROWS with FOUND_ROWS(), but this will defeate the purpose of the LIMIT clause -- speed -- because MySQL will have to figure out all the results of the

CASE statement and version 4.1.x

2005-03-08 Thread Homam S.A.
In the documentation, it doesn't mention which version of MySQL supports the CASE statement, but it refers to stored procedures, so is it only supported for 5.x? I can't get any example of a CASE statement work in MySQL. The reason I'm asking is because in other SQL dialects, such as T-SQL, you

Getting weird error when updating table

2005-03-07 Thread Homam S.A.
Whenever I try to update an ISAM table (through a join with nother small lookup table, also ISAM), I get the following error: Error Code : 1114 The table '#sql_910_0' is full I read the following in the documentation: http://dev.mysql.com/doc/mysql/en/full-table.html But none of the reasons

Temp file hanling gone wrong

2005-03-07 Thread Homam S.A.
MySQL keeps throwing error 1114 on temp files (those that MySQL creates behind the scenes when executing a query and start with #), which is pretty dumb because there's no way for the user to set the maximum row size on temp table files. It seems that MySQL is wrongly setting the temp size and

Re: Avoiding filesort #2

2005-02-23 Thread Homam S.A.
MySQL decide to use no index in some situations. Mike - Original Message - From: Homam S.A. [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: February 22, 2005 8:12 PM Subject: Avoiding filesort #2 Actually with the query below it does avoid filesort

Re: Avoiding filesort #2

2005-02-23 Thread Homam S.A.
--- mos [EMAIL PROTECTED] wrote: At 05:12 AM 2/23/2005, Homam S.A. wrote: Thanks Mike for your feedback. Unfortunately the HANDLER statement has the same limitation, i.e. it doesn't allow you to specify range criteria for index key parts. You have to specify constants in the index_name

Avoiding filesort

2005-02-22 Thread Homam S.A.
I read How My SQL Optimizes Order By (http://dev.mysql.com/doc/mysql/en/order-by-optimization.html), and I'm aware of its severe limitation due to the one-index-per-table rule. However, even when I follow all the roles, I'm still getting filesort instead of using the index order. So I created an

Avoiding filesort #2

2005-02-22 Thread Homam S.A.
Actually with the query below it does avoid filesort, but once I use anything other than the equal operator (e.g. ColC 5), it reverts back to filesort. Any thoughts? --- Homam S.A. [EMAIL PROTECTED] wrote: I read How My SQL Optimizes Order By (http://dev.mysql.com/doc/mysql/en/order

Re: Avoiding filesort #2

2005-02-22 Thread Homam S.A.
it in your WHERE portion of the statement. This could confuse the index selection process and have MySQL decide to use no index in some situations. Mike - Original Message - From: Homam S.A. [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: February 22, 2005 8:12 PM Subject

Re: Mysql hypothetical performance

2005-02-11 Thread Homam S.A.
I think you meant select session from users where user_id = 'X'. Anyway, it doesn't matter how big your table is as long as you build an index on (user_id, session). This way MySQL doesn't have to touch the table for this query. --- Scott Haneda [EMAIL PROTECTED] wrote: I build a few login

Why MySQL doesn't cache queries that populate temp tables?

2005-02-11 Thread Homam S.A.
Why MySQL insists on ignoring the query cache whenever I use the same query repeatedly to populate a temp table? So I have: create temporary table MyTable select SQL_CACHE * from SomeTable WHERE (A bunch of criteria) limit 1000; SomeTable is a read-only table. If I issue the query without the

Re: Need help with historic aggregation of data

2005-02-11 Thread Homam S.A.
select test, max(audit_date) from your_table where device = 1 group by test order by 1 --- Daevid Vincent [EMAIL PROTECTED] wrote: I need to get the aggregate data from various tables for a report. The idea is that we audit devices daily on a schedule, and also allow users to audit the

Re: Remove spaces

2005-02-11 Thread Homam S.A.
update your_table set your_field = trim(your_field) --- John Berman [EMAIL PROTECTED] wrote: Hi I have a table with a number of fields The table is already populated, however some entries have got spaces both before and after the data. Future imports into the table will have the

RE: Remove spaces

2005-02-11 Thread Homam S.A.
think trim() was supported long time ago. --- John Berman [EMAIL PROTECTED] wrote: Thanks for this I did this: update mc_census set surname = trim(surname) however it fails with a syntax error ? I'm on 4.1 Regards John B -Original Message- From: Homam S.A. [mailto

Full-text search performance issues

2005-02-10 Thread Homam S.A.
Since MySQL stores RowIDs with the indexed words instead of the table's primary key IDs, and since it uses only one index per table in any query, performing a full-text search on a large table (several million rows) and joining it with another large table proves to be extremely slow! The

Simmering FT Queries

2005-02-08 Thread Homam S.A.
I'm evaluating MySQL FT search, and so far it's been very disappointing. The queries on a test table of about 2 million rows with Text columns (average 75 words per text column) are extremely slow, compared to a regular FT search engine, like Lucene. What's disturbing is that it doesn't consume

Rowcount?

2005-02-03 Thread Homam S.A.
Is there a rowcount global variable or function in MySQL equivalent to @@rowcount in MS SQL Server that returns the number of affected rows from the last SQL statement on the current connection? Thanks! __ Do you Yahoo!? All your favorites on

Why does dropping indexes takes such a long time?

2005-02-02 Thread Homam S.A.
I have a non-primary-key index on a large MyISAM table, and dropping the index takes a long time, in addition to maxing out the CPU utilization in its final 1/3 interval. Why is that? In MS SQL Server for example, dropping the index is almost instantaeous, unless it's clustered and you have

Re: Why does dropping indexes takes such a long time?

2005-02-02 Thread Homam S.A.
. Administracion de sistema de respaldo : Mauricio Guajardo. Saludos, Alvaro Avello Administrador de Red. Servinco S.A. - Original message follows - --- Keith Ivey [EMAIL PROTECTED] wrote: Homam S.A. wrote: I have a non-primary-key index on a large MyISAM table, and dropping

Why MySQL is very slow in dropping indexes?

2005-01-28 Thread Homam S.A.
Dropping an index on a MyISAM table should be instantaneous. It should only take as long as deleting the idx file from the file system. But it's taking almost as long as creating the index itself! Here's my queries and time they took: /*[10:58:17 AM][367172 ms]*/ alter table MyTable add index

How to specify start-up options when it's running as service?

2005-01-14 Thread Homam S.A.
I know about my.ini, but I'm not sure how to specify these mysqld start-up options to it: --shared-memory --shared-memory-base-name=MYSQL I tried adding entries like: shared-memory=true shared-memory-base-name=MYSQL But it didn't work. So my question is, How do I specify the above mysqld

Index fill factor

2005-01-05 Thread Homam S.A.
What's the default fill factor on MyISAM B-Tree indexes? I know it's 15/16 by default for InnoDB, but nothing is mentioned about MyISAM. For example, if I'm going to create read-only tables and index them, I'd like the fill factor to be 100% since there won't be updates and therefore I'm not

RE: MyODBC 3.5.9 and MySQL 4.1.8

2005-01-05 Thread Homam S.A.
You could also leave the password blank if you don't want to force MySQL to revert to the old password encryption on start-up. This should be fine if your server is in the DMZ and you control all the processes that have access to the server. Unfortunately, 4.2.x breaks backward compatibility with

RE: MyODBC 3.5.9 and MySQL 4.1.8

2005-01-05 Thread Homam S.A.
Tom, this is awesome! It must have been fresh out of dev because I downloaded 3.51.09 a couple of days ago. I just downloaded it and it works fine with 4.1 authentication. Thanks! --- Tom Crimmins [EMAIL PROTECTED] wrote: Try MyODBC 3.51.10. It supports 4.1 auth. Here is a link to a mirror

Does MySQL work with DTS?

2005-01-04 Thread Homam S.A.
I have a simple table in SQL Server that doesn't have any BLOB field (no text or image columns). Only char, varchar, bit, and int columns. I created a DTS package that uses a simple select to copy the contents of this table into an identical table created in MySQL through MyODBC 3.51. Whenver I

Re: Does MySQL work with DTS?

2005-01-04 Thread Homam S.A.
OK, I figured out what was going on. When I created a varchar(256) in the MySQL destination table, MySQL silently converted to it text (instead of protesting that varchar maxes out at 255), and I just found the problem by executing show create table MyTable. --- Homam S.A. [EMAIL PROTECTED

Copying DB and full-text search files from one server to another

2004-12-22 Thread Homam S.A.
Is it possible to copy the database files (both MyISAM and InnoDB) that contain tables, indices, and full-text indices from one MySQL server to another running/active MySQL server and start using them right away? I appreciate your help! Homam

Re: simple subquery syntax not working!

2004-12-22 Thread Homam S.A.
Make sure the subquery returns a scalar value. Either the roleDBNum column has to be unique or you need to apply an aggregate function to reduce to a single value. If the the subquery returns many values, use the IN operator instead of =. Disclaimier: I'm still new to MySQL, but I'm assuming it

Performance of Joining Tables From Different Storage Engines -- Re: MyISAM vs. InnoDB for heavily-indexed, read-mostly data

2004-12-21 Thread Homam S.A.
Thanks Mike for the information. Yes, Emmett mentioned the same thing in a private message, and it seems that MyISAM is exactly what I'm looking for: a heavily-indexed large table that will be also indexed for full-text search and built off-line -- no updates whatsoever. However, I will be

Re: Performance of Joining Tables From Different Storage Engines -- Re: MyISAM vs. InnoDB for heavily-indexed, read-mostly data

2004-12-21 Thread Homam S.A.
Thanks Mike. I think testing ultimately determines how efficient heterogeneous engine joins are. I just wanted to know if someone had issues with them in a heavy-load environment. --- mos [EMAIL PROTECTED] wrote: At 04:00 PM 12/21/2004, Homam S.A. wrote: Thanks Mike for the information. Yes

How to execute selected text in Query Broswer?

2004-12-21 Thread Homam S.A.
I was wondering what's the shortcut for executing only selected text in the query window (SQL Query Area) in MySQL Query Browser. Using Ctr-E or Ctrl-Enter executes everything in the window, not just the selected text, as MS Query Analyzer does. It's a great hassle to have to comment all the

MyISAM vs. InnoDB for heavily-indexed, read-mostly data

2004-12-20 Thread Homam S.A.
I'm new to MySQL and I was wondering which storage engine is the best choice for heavily-indexed, read-mostly data. From skimming over the documentation, it seems that MyISAM is a better choice since it doesn't have the transactional overhead. Yet I'm worried that it's becoming depricated and