Re: How to utilize 16 logical CPUs
Your mysql db is only using 496Mb of ram? i have a server with 1GB ram where mysql uses more mem than yours does - you should probably tune your server system variables a bit to utilize your memory better. Christian Hammers wrote: On Tue, Aug 22, 2006 at 10:20:47AM -0600, Michael Loftis wrote: One other quick ? -- Are you using a 64 bit (x86_64/EMT64) or 32-bit? If you're still in 32-bit mode the extra memory over 4Gb can actually slow the system down since it has to page between memory zones. It was choosen to run on i386 i.e. 32-bit mode for compatibility to Java and other servers in the farm. But as you can see not even the 3GB border is touched: PID USER PR NI VIRT RES SHR S %CPU %MEMTIME+ COMMAND 5076 mysql 15 0 1434m 496m 4992 S 99.9 6.1 54931:46 mysqld But despite the 99% CPU, vmstat thinks the system is idle. procs ---memory-- ---swap-- -io --system-- cpu r b swpd free buff cache si sobibo incs us sy id wa 1 0 0 2959212 139684 383155600 1 01 1 6 3 88 3 0 0 0 2959584 139684 383051600 0 0 4785 0 7 4 89 0 1 0 0 2959212 139692 383154800 0 100 3453 0 7 4 89 0 6 0 0 2957104 139700 383076000 8 0 3696 0 7 5 87 0 2 0 0 2958592 139700 38310200032 0 4230 0 7 5 88 0 1 0 0 2958220 139712 383074800 0 596 3904 0 8 5 87 0 bye, -christian- -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Another question on Cardinality??
Have you considered reading up on basic database management? There are plenty of good material on the web for you to read where you can actually learn how to manage databases, so you don't have to ask others about every single detail. Ratheesh K J wrote: Hello all, Another question on cardinality. Consider a table with 1000 rows and columnns. Details of the columns are as below: FLD_1 - int - cardinality 1000 - PRIMARY KEY FLD_2 - tinyint- cardinality 400 FLD_3 - varchar - cardinality 10 FLD_4 - varchar - cardinality 2 FLD_5 - varchar - cardinality 5 Assuming that cardinality exactly is the number of distinct values for that column, Which are the fields that is best for indexing for the table. Is it meaningful for me to index FLD_3, FLD_4 and FLD_5 knowing that their cardinality is always going to be the same? There are certain scenarios wherein I have queries on the tables as below: 1) Select * from table where FLD_4 = 1; 2) Select * from table where FLD_5 = 3; 3) Select * from table where FLD_3 1 AND FLD_5 6; considering all the above cases, what should I conclude? should I have indexes on these three fields? Looking for a specific answer than a depend on situation kind of an answer. Thanks Ratheesh Bhat K J -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: FW: How do I find all the users that are new since my last login (repost)
You could add an extra field called last_login_date which you'd set only once per session - at login time. At login time you'd set this to the value that exists in login_date. Then use that for comparison against created_on. Daevid Vincent wrote: I have a SQL challenge I'm not sure how to solve. But it's so common, I feel kind of stupid asking this... I have a 'user' table with 'login_date' which is an auto updated DATETIME column and a 'created_on' which is a DATETIME (but not updated after the record is created the first time) I want to show a list of users who are new since my last login. But the problem is that my last login changes for every page load (i.e. it is updated so that I can guestimate if a user is logged in still or not... I consider 10m to be the window, since rarely do users ever officially 'logout'). So I think I need to have a SQL query that only deals with the date, not the mins/secs? I'm just not sure the optimum way to do this. The other challenging part seems to me that as soon as 'login_date' is updated, then everyone that was 'new' is now 'old' because the login_date just got updated right? I kinda want the 'new' user status to persist for the whole session [or maybe even the whole day (that is, I could logout/in and those people would still show as new) -- but I can live with just being new for the session] How is this sort of thing usually handled? Do I need another column that isn't auto-updated and that just get's set upon each new 'login' session? Unlike a message board or web based email system, I CAN'T flag each user as viewed or something like that. This feature is for a network type scenario where a user can see new users added to their network of friends since the last time they logged in. Or so the Administrators can see all new users. This type of thing. ÐÆ5ÏÐ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Table analysis - Help required urgently
If i was you i'd start reading the manual. Look under the optimization chapter. Also, brush up on database normalization and look into how exactly the tables are being used - run explains on the sql statements that are used with the tables and see how you can optimize index usage. Ratheesh K J wrote: Hello all, I am required to analyze all the tables of our system. I need to know the key parameters that should be taken into consideration for analysis. I am not speaking about ANALYZE TABLE tbl name. I am required to manually look into all table structures and pin point problems ( if any ). So it would be helpful if i could know about 1) what exactly I have to look for in the tables. 2) Index management. Which fields are to be indexed and which not 3) How big can a table be? We have tables which have more than 50 lakhs of rows. Any select queries, insert queries or update queries are taking more time to execute. So what is a preferable table size. 4) Any other suggestions Thanks, Ratheesh Bhat K J -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Fatal error
1) Throw away the backup.sql as it is useless 2) Talk to the guys who made drupal and make them aware of the flaw in their software 3) Change the php.ini settings for maximum execution time next time try to place non-mysql related questions elsewhere ;) Kaushal Shriyan wrote: On 8/3/06, Martin Jespersen [EMAIL PROTECTED] wrote: Looks like drupal had an error when doing the backup - mysql is complaining over the fact that your backup.sql file contains a html formated fatal error message. Kaushal Shriyan wrote: Hi ALL I have taken backup of http://mydomain.com/?q=admin/database through drupal 4.6.3 by selecting all tables and it asked me to save as backup.sql. Now when i run [EMAIL PROTECTED] root]# mysql -u kaushal -h bdc31096e.in.office.aol.com -p drupal /home/kaushal/drupal/backup.sql Enter password: ERROR 1064 at line 55817: You have an error in your SQL syntax near 'br / bFatal error/b: Maximum execution time of 30 seconds exceeded in b' at line 1 [EMAIL PROTECTED] root]# I get the above error Any clue Please let me know if you need more info on this issue Thanks and Regards Kaushal Hi Martin How do i fix this issue Thanks Kaushal -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Doing a join
select g.GROUP_NAME, count(mg.MEM_ID) as NUMBER_OF_MEMBERS from GROUPS g left join MEM_GRO mg using(GRO_ID) group by g.GRO_ID John Meyer wrote: I have two tables: MEMBERS: MEM_ID ... GROUPS: GRO_ID: ... And one joiner MEM_GRO: MEM_ID, GRO_ID I want to print out a list like this GROUP_NAME, NUMBER_OF_MEMBERS Even when the number of members is 0, how do I do that? -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: FULL TEXT SEARCH ALTERNATIVES...
You can tune the fulltext search in a few ways using the config, try read up on the various server variables that has to do with fulltext indexing. Other than that there is always the option of upgrading the hardware :) [EMAIL PROTECTED] wrote: Hi! I'm getting a lot of pushback on using mysql for full-text searching on over 30,000,000 documents. It's starting to slow down when using more than 10-15 keywords. Is there an alternative anyone is using? I don't want to replace the database, but I do need to speed up the keyword search. Any ideas? Thanks in advance! -- Avi -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Multiple single column indexes
It depends what you need and how your data looks. Say you have a table with 4 columns: col1 has 1000 dictinct values col2 has 1 dictinct values col3 has 100 dictinct values col4 has 10 dictinct values In this case: select col1,col2 from tbl where col1=... and col2=... Having a single index based on col1,col2 col3 is the best option, since no actual table lookup is needed if you have that index. in this case: select * from tbl where col3=... and col1=... and col2=... it is best to have a seperate index for col1, col2 and col3 - in this case the column with the smallest amount of distinct values should be first, thus we start with col3. The result that needs to be returned (*) cover columns that are outside the where clause, so having an index on all the fields in the where clause makes no sense, since a table lookup is needed anyway. In this case having an index of col1,2,3 combined gives us an index with a much larger cardinality than the sum of the cardinalities in 3 seperate indexes (one for each column) and thus a slower index lookup. In some cases, you might find a combined index faster even in this case, but in my experience that is quite rare. But... as i said in the beginning, it really does depend on your data and the queries you use - always use explain to check how mysql optimizes your queries, and run tests like the ones you already did to see what works best... sometimes mysql surprises the heck out of me even tho i've been using it since 95 ;) André Hänsel wrote: 2. Does it really make sense to have single indexes per column when the columns are used together in one WHERE clause? Best regards, André -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Fatal error
Looks like drupal had an error when doing the backup - mysql is complaining over the fact that your backup.sql file contains a html formated fatal error message. Kaushal Shriyan wrote: Hi ALL I have taken backup of http://mydomain.com/?q=admin/database through drupal 4.6.3 by selecting all tables and it asked me to save as backup.sql. Now when i run [EMAIL PROTECTED] root]# mysql -u kaushal -h bdc31096e.in.office.aol.com -p drupal /home/kaushal/drupal/backup.sql Enter password: ERROR 1064 at line 55817: You have an error in your SQL syntax near 'br / bFatal error/b: Maximum execution time of 30 seconds exceeded in b' at line 1 [EMAIL PROTECTED] root]# I get the above error Any clue Please let me know if you need more info on this issue Thanks and Regards Kaushal -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
swapping column values in update
I just ran the following sql (on mysql 4.1.20): update tbl set col1=col2, col2=col1 To my surprise, mysql updates col1 via col1=col2 before reading it for use in col2=col1, so I end up with the same value in both columns, which, of course, was not my intention. Thinking about it, this behavior in mysql makes perfect sense, so thats not the issue. I could of course add a temporary col3 to use as a kind of buffer field, and do alter table to add col3 update tbl set col3=col1, col1=col2, col2=col3, col3='' alter table to remove col3 That seems like a waste to me tho. There must be a smarter way. So my question is: Does anyone know of a way to force mysql to read all the values first before actually doing the update? Or just has a smarter way of doing this? -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: swapping column values in update
it's a frequent operation based on a where clause Barry Newton wrote: At 06:35 PM 8/1/2006, Martin Jespersen wrote: I just ran the following sql (on mysql 4.1.20): update tbl set col1=col2, col2=col1 To my surprise, mysql updates col1 via col1=col2 before reading it for use in col2=col1, so I end up with the same value in both columns, which, of course, was not my intention. Thinking about it, this behavior in mysql makes perfect sense, so thats not the issue. If this is a one-time operation, it would seem easier to rename the columns. In some cases, even if it's a little more frequent than that. Barry -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Problems with WHERE clause
Do the right thing(TM) and don't use an alias that is the same as a field that exists (this was mentioned before by someone else). Since there is a field in your join named fee, using fee as an alias, is bound to cause your trouble. Also, trying to call sum(p.fee) twice is a waste of cputime. I say trying here because this is what fails, you are not allowed to call sum in your where clause, thus the Invalid use of group function. try SELECT s.id, s.name, SUM(p.fee) AS fee_total FROM serie AS s INNER JOIN race_serie AS rs ON rs.serie_id = s.id INNER JOIN races AS r ON r.id = rs.race_id INNER JOIN participants AS p ON p.race_id = r.id WHERE s.receipt = 1 AND p.rider_id = 236 AND fee_total 0 GROUP BY s.id ORDER BY s.f_date; and see if that works for you. Jørn Dahl-Stamnes wrote: On Sunday 30 July 2006 12:37, Gabriel PREDA wrote: You must specify explicitly what 'fee' to use... so if you wand every p.fee to be greater than zero then you must do: SELECT s.id, s.name, SUM(p.fee) AS fee FROM serie AS s INNER JOIN race_serie AS rs ON rs.serie_id = s.id INNER JOIN races AS r ON r.id = rs.race_id INNER JOIN participants AS p ON p.race_id = r.id WHERE s.receipt = 1 AND p.rider_id = 236 AND p.fee 0 GROUP BY s.id ORDER BY s.f_date; This did the trick. What I want is to find out which series a given rider has participated where (s)he has paid fee for participating (in some cases a rider my participate without haveing paied). If the rider has paied fee once in a serie, then the sum will be more than 0. But will the query above give me the id and name for a serie where a rider has participated but not paid? One way to find out is to test it. If you want the sum to be larger that zero then you would have to do: SELECT s.id, s.name, SUM(p.fee) AS fee FROM serie AS s INNER JOIN race_serie AS rs ON rs.serie_id = s.id INNER JOIN races AS r ON r.id = rs.race_id INNER JOIN participants AS p ON p.race_id = r.id WHERE s.receipt = 1 AND p.rider_id = 236 AND SUM(p.fee) 0 GROUP BY s.id ORDER BY s.f_date; This gave the following error: ERROR (HY000): Invalid use of group function -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: optimize mysql geometric query
Try to run an explain on the query to see how mysql optimizes it. Also have a look at your system resources while the query runs to see if you have a problem with memory/swapping. I am not sure (since i've never used union), but my guess is that mysql uses temporary tables for this, so maybe tuning server parameters like tmp_table_size can help. PRASHANT N wrote: hi, i have attached my geometric query which is very slow. how to optimize this query regards shann ___ Hot new product - Spider Networks introduces stunning online ePortfolio solution for students and teachers http://www.spider-networks.net/solutions/eportfolio.html select A.name,A.district,x(GeomFromText(AsText(A.geo))) as x,y(GeomFromText(AsText(A.geo))) as y,(GLength(LineStringFromWKB(LineString(AsBinary(geo),AsBinary(GeomFromText('POINT(76.67472 11.83884)')) as Distance FROM (select geo,name,district from cities_point union all select geo,name,district from cities_font_point union all select geo,name,district from State_Highways_point union all select geo,name,district from Other_Roads_point union all select geo,name,district from Major_Roads_point union all select geo,name,district from Vet_Clinics_point union all select geo,name,district from University_point union all select geo,name,district from Tourist_Info_point union all select geo,name,district from Temples_point union all select geo,name,district from Taxi_Stands_point union all select geo,name,district from Stadiums_point union all select geo,name,district from Sports_Clubs_point union all select geo,name,district from Shops_WhiteGds_point union all select geo,name,district from Shops_Sports_point union all select geo,name,district from Shops_RealEstate_point union all select geo,name,district from Shops_Music_point union all select geo,name,district from Shops_Misc_point union all select geo,name,district from Shops_LPG_point union all select geo,name,district from Shops_Jewellery_point union all select geo,name,district from Shops_Furnt_point union all select geo,name,district from Shops_Footwear_point union all select geo,name,district from Shops_Computer_point union all select geo,name,district from Shops_Chemists_point union all select geo,name,district from Shops_Bakery_point union all select geo,name,district from Shops_Apparel_point union all select geo,name,district from Shopping_Ctrs_point union all select geo,name,district from Services_Travel_point union all select geo,name,district from Services_Professional_point union all select geo,name,district from Services_Financial_point union all select geo,name,district from Service_Stations_point union all select geo,name,district from Schools_point union all select geo,name,district from Restaurants_point union all select geo,name,district from Religious_Pls_Oth_point union all select geo,name,district from Railway_Stations_point union all select geo,name,district from Railway_Reservations_point union all select geo,name,district from PreSchools_point union all select geo,name,district from PostOffices_point union all select geo,name,district from PoliceStations_point union all select geo,name,district from PoliceChaukis_point union all select geo,name,district from PetrolPumps_point union all select geo,name,district from Parks_point union all select geo,name,district from OtherInstt_point union all select geo,name,district from Offices_point union all select geo,name,district from Office_Airlines_point union all select geo,name,district from Museums_point union all select geo,name,district from Mosques_point union all select geo,name,district from Misc_point union all select geo,name,district from Libraries_point union all select geo,name,district from LevelCrossing_point union all select geo,name,district from Industries_point union all select geo,name,district from Hotels_point union all select geo,name,district from Hostels_point union all select geo,name,district from Hospitals_point union all select geo,name,district from Historical_Pls_point union all select geo,name,district from Gymnasiums_point union all select geo,name,district from Gurdwaras_point union all select geo,name,district from Graveyards_point union all select geo,name,district from GovtOffices_point union all select geo,name,district from Dispensaries_point union all select geo,name,district from Discotheques_point union all select geo,name,district from Diagnostic_Ctrs_point union all select geo,name,district from CyberCafes_point union all select geo,name,district from Cultural_Centres_point union all select geo,name,district from Crematory_point union all select geo,name,district from Couriers_point union all select geo,name,district from Computer_Instt_point union all select geo,name,district from Colleges_point union all
Re: What does optimize mean?
read the manual: http://dev.mysql.com/doc/refman/5.0/en/optimize-table.html Jesse wrote: Seeing posts about mysqlcheck on the list prompted me to check out that utility. A lot of it I can see is very useful, and I understand what it does. However, what does the optimize command mean? What does it do? The help file says that the -o option optimizes, but what does that mean?? I ran it on one of my databases, and most of them said OK, and some of them said table is already up to date. But I still have no idea what it did, if anything. Thanks, Jesse -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: MySQL performing too badly under heavy load - urgent hlp needed
I doubt apache is to blame. 5 seconds for a query on a website is extremely slow, so if that is your normal results, then you have a problem there already. I've been building database driven websites for around 11 years and i don't think i can remember a single time i went into production with a single query that was slower than 0.1 second, unless it was something very rarely used for administration purposes. From the top of my head i'd say your problem is either a) poor datamodel design which forces slow queries b) poor usage of indexes in the database (use explain to check) c) non-optimized configuration of the server (have you tuned the server parameters to the way you use the server?) d) insufficient hardware for your needs e) any combination of the above Ratheesh K J wrote: Hello all, Stuck up with a major problem. Urgent hlp required MySQL seems to be performing too bad during heavy load on the server. Queries which normally take around 5 secs to complete are taking more than 1000 secs to complete during load. What could be the reason. Show processlist shows many process in sending data state. All tables are of INNODB type. But we are not running any transactions as yet. The server is clogged due to many httpd requests (150 Max). All the httpd requests are in W state ( means sending response ). What could be causing this. Is it MySQL or is it Apache... Any suggestions would help... Thanks, Ratheesh K J -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Checkboxes
Looks like more of a php question that a mysql question ;) anyway, the mysql part: use either an unsigned interger (tinyint, if less than 256 possibilities, smallint if over 256 but less than 65565, etc) or use a set or enum. Using a varchar is not really the way to go. If you choose to use an integer and you need some kind of string representation of the choice, use a secondary table to hold the string values and let the integer in the main table be a foreign key to the secondary table ;) Nicholas Vettese wrote: I am trying to allow a user to use checkboxes for multiple selections, and I am trying to get the database to record the choices made by the user. I am using a VARCHAR(250), but I am guessing that may be wrong. Also, other than adding a [] to the end of the 'name' (e.g. input type=checkbox name=mod_type[] value=alternative /Alternativebr /), what do I need to do? I hope I am asking this question correctly. If not, please feel free to flame me. Nick -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Select Query taking time
Ratheesh K J wrote: Hello All, I run a select query to see its speed. It took around 5 seconds. Now i run the same query simultaneously twice usng two instances of the client tool. It took 10 seconds for both the queris to complete. Its not 5 secs + 5 secs. Both the queries were running till 10 secs when i saw using mytop. In the 11th sec both the queries ended. Running it thrice simultaneously, it took 15 secs for all the three queries to complete. In such a case should this query be considered as slow? We are actually checking for queries which take longer than 12 secs and regarding such queries as slow. The moment we find such a query, a mail is sent to the DBA saying that the query is slow. So in a day there are more than 400 such slow query notifications flowing into the mail box. My questions are, Should the simultaneous queries take so long? Should'nt both queries have finished by 6 secs rather than 10 secs? Without query caching enabled, yes it is perfectly normal that the time spent is rising in a linear fashion, eg 4 simulatious would be 20 seconds, 5 25 secs and so on - this just means that your query run by itself is able to utilize all available resources such as cpu time. Look at it this way: 1 query will use 100% of the available cpu and it takes 5 seconds. When you run two at the same time they each have 50% cpu to use, and thus take 10 seconds (5 seconds * 100 / 50). With 3 they each have 33,1/3% and take 15 seconds ( 5 seconds * 100 / 33,1/3) and so on. Is this a right strategy to track slow queries? Yes and no. It is always wise to test your queries to see how the do speed wise, but if you only measure time you aren't really getting the full picture. You have to also look at what else the system is doing - if a query is bottlenecked only by available cpu, it will run at very different speeds depending on how busy the system is with other things - try to bzip2 a 500MB file while running the query and see how much time it takes then for instance ;) And as always remember to use explain to see how mysql optimizes your query so you can modify it if needed, especially complicated joins can sometimes be alot faster if you tweak them a bit. Any suggestions would help. Thanks, Ratheesh K J -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Searching through an alphabetical range
Depending on the size of your table, it can be faster using SELECT lastname FROM employee WHERE lastname BETWEEN 'm' AND 'z' GROUP BY lastname; On a table with 2,5 Mill. records the speed diff is over 1000% on my system. ViSolve DB Team wrote: Hello Paul, You can try this: SELECT DISTINCT lastname FROM employee WHERE lastname BETWEEN 'm' AND 'z'; Thanks, ViSolve DB Team. - Original Message - From: Paul Nowosielski [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Friday, July 21, 2006 10:33 PM Subject: Searching through an alphabetical range Dear All, I need to write a query that searches last names between the ranges of m through z. Is there a way to do this in the query? Thank You, -- Paul Nowosielski Webmaster office: 303.440.0666 ext 219 cel: 303.827.4257 -- 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: Struggling with the logic
As mentioned before you really should sue the date data type in mysql, or alternativly use an int and store the date as seconds since the epox, so that you can do simple math for this type of query. Any other way of storing dates is basically shooting yourself in the foot. That said, if you choose to store it as a varchar use: Select * from submissions where approvedate in ('07/01/2006', '07/02/2006', '07/03/2006',...); Be aware how extremely slow this performs compared to the options mentioned above tho. John Berman wrote: Hi I'm struggling with some logic I have a table called: submissions and each record has an approvedate field which stores the date mm/dd/ I want to display all records for 7 days only from their approved date so I guess something like Select * from submissions were approvedate - this is were im getting stuck Pointers appreciated, im sure its simple ? Regards John B -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: database back up
You can usually find the database files under the var subdirectory under your installation, unless another datadir was specified at compiletime. ;) Martin Joko Siswanto wrote: Dear All if myqsl service can't start, where can i found the file and back up it? [under windows and linux] Thanks, Joko Siswanto -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: How to query on part of a date column?
As long as backticks are used around fieldnames, spaces and/or reserved words are fine, tho it does tend to create more work for the user ;) mos wrote: At 12:02 PM 7/20/2006, you wrote: I've got a table of people who registered for a convention. Each person has a registration date, kept in a standard date field. How do I select for people who registered in a particular month or year? The obvious tests like: Select * from Capclave2005reg Where Year('Date Paid') = 2004; return no rows. I can extract any piece of that date I want in a SELECT, but can't seem to use it in a WHERE clause at all. There has to be something really obvious that I'm missing? Barry Newton Barry, I strongly recommend getting rid of the spaces in your column/table names and replace them with an underscore character _. You are only creating problems for yourself if you leave the blanks in the names. Mike -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: 3.23.58 - 5.0.22 upgrade
Using dumps are almost always the way to go, upgrading the datafiles themselves is something you should avoid unless you are into heavy wizardry and/or pain. Dan Trainor wrote: Martin Jespersen wrote: Dan has a very good point, be mindfull of the changed password algorithm, that actually was a bit of a bother to me since i have tons of users defined in my grant tables. Dan Buettner wrote: Dan, I wouldn't bother with the intermediate steps (4.0, 4.1) . Waste of time (fine products, but you say you want to go to 5.0). I'd go direct to 5.0, using mysqldump'd data as Martin did. If you're all-MyISAM then it might also work to simply upgrade your binaries and keep your data files, though you'll want to watch for the fix permissions script and also be mindful of the password changes that came about with 4.1. Dan On 7/13/06, Martin Jespersen [EMAIL PROTECTED] wrote: I recently upgraded from 3.23.58 - 4.1.20 without any hickups. I simply dumped my databases with mysqldump on the 3.23.58 installation and imported them again from inside the mysql client by using the source command. Dan Trainor wrote: Hi - I know we've rolled this around the list a few times, but I was wondering if there's been any real development on the subject lately. I know half of you are saying Forget it... go with a newer version and get over it, and I'd really really like to, but i have a lot of data store under 3.23.x. The documentation says that you must follow 3 - 4.0 - 4.1 - 5.0 ... ..., and that's just what I'm about to do. I guess what I'm looking for here is some advice from people who have done it. If there's not an all-in-one silly stupid way to upgrade the data in this manner (i.e. with one fell swoop of some handy dandy application), would someone on an RPM-based system simply upgrade RPMs in sequential order as indicated, and hope that the data follows? Is this probably one of the more successful ways of doing this? I'm still exploring my options, but I think that's what I'm going to end up going with here - one step at a time. If you guys wouldn't mind terribly talking about this for a few more posts, I (and hopefully others) would greatly appreciate it. Thanks for the time -dant -- Hi - Well, I've been trying a few things with this, however I can't quite seem to get to the point where this would be any easier. The problem is, I only have data files. I don't have a MySQL dump, and don't see myself being able to grab a dump anytime soon. So I guess what I'm faced with now is bringing up a 3.23.58 server anyway, if only for the purpose of a massive MySQL dump. How's that sound? Thanks! -dant -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: 3.23.58 - 5.0.22 upgrade
I recently upgraded from 3.23.58 - 4.1.20 without any hickups. I simply dumped my databases with mysqldump on the 3.23.58 installation and imported them again from inside the mysql client by using the source command. Dan Trainor wrote: Hi - I know we've rolled this around the list a few times, but I was wondering if there's been any real development on the subject lately. I know half of you are saying Forget it... go with a newer version and get over it, and I'd really really like to, but i have a lot of data store under 3.23.x. The documentation says that you must follow 3 - 4.0 - 4.1 - 5.0 ... ..., and that's just what I'm about to do. I guess what I'm looking for here is some advice from people who have done it. If there's not an all-in-one silly stupid way to upgrade the data in this manner (i.e. with one fell swoop of some handy dandy application), would someone on an RPM-based system simply upgrade RPMs in sequential order as indicated, and hope that the data follows? Is this probably one of the more successful ways of doing this? I'm still exploring my options, but I think that's what I'm going to end up going with here - one step at a time. If you guys wouldn't mind terribly talking about this for a few more posts, I (and hopefully others) would greatly appreciate it. Thanks for the time -dant -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: 3.23.58 - 5.0.22 upgrade
Dan has a very good point, be mindfull of the changed password algorithm, that actually was a bit of a bother to me since i have tons of users defined in my grant tables. Dan Buettner wrote: Dan, I wouldn't bother with the intermediate steps (4.0, 4.1) . Waste of time (fine products, but you say you want to go to 5.0). I'd go direct to 5.0, using mysqldump'd data as Martin did. If you're all-MyISAM then it might also work to simply upgrade your binaries and keep your data files, though you'll want to watch for the fix permissions script and also be mindful of the password changes that came about with 4.1. Dan On 7/13/06, Martin Jespersen [EMAIL PROTECTED] wrote: I recently upgraded from 3.23.58 - 4.1.20 without any hickups. I simply dumped my databases with mysqldump on the 3.23.58 installation and imported them again from inside the mysql client by using the source command. Dan Trainor wrote: Hi - I know we've rolled this around the list a few times, but I was wondering if there's been any real development on the subject lately. I know half of you are saying Forget it... go with a newer version and get over it, and I'd really really like to, but i have a lot of data store under 3.23.x. The documentation says that you must follow 3 - 4.0 - 4.1 - 5.0 ... ..., and that's just what I'm about to do. I guess what I'm looking for here is some advice from people who have done it. If there's not an all-in-one silly stupid way to upgrade the data in this manner (i.e. with one fell swoop of some handy dandy application), would someone on an RPM-based system simply upgrade RPMs in sequential order as indicated, and hope that the data follows? Is this probably one of the more successful ways of doing this? I'm still exploring my options, but I think that's what I'm going to end up going with here - one step at a time. If you guys wouldn't mind terribly talking about this for a few more posts, I (and hopefully others) would greatly appreciate it. Thanks for the time -dant -- 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: very basic questions
1: .sql files are usually textfiles with sql statements in them delimited by ; 2: do the following 1) start the client - /path/to/mysql -u user -ppass 2) select your database (if nescessary) - use db 3) import the sql file - source /path/to/fill_help_tables.sql [EMAIL PROTECTED] wrote: Hello, I'm new to MySQL and SQL have some very basic questions about them. I'm relatively competant in programming, so maybe if someone could answer ... 1. Are SQL files, eg. foo.sql, referred to as scripts or programs or what. (In searching for answers to 2. below and don't know if I'm using the right terms) 2. How do you get MySQL to execute a SQL file? I downloaded fill_help_tables.sql from the website, and it's comments tell how to load from the command line: mysql -u root -p mysql file_name but I would like to load a file from the interactive mode, ie. from the mysql prompt. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
space usage
Does anyone havea clue of how mysql optimizes empty fields and how query speed is affected? i have a db with around 3 million rows where i need to add 2 new fields - one smallint and one varchar(10) for alot of the rows they will be empty, but because of query speed i opt to put them ion the maintable instead of a seperate table so i can avoid slow joins. what will be better for queryspeed/size: adding them with NULL using NULL as default or with NOT NULL using 0 and '' as defaults? Regards Martin Jespersen -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Backup questions
Jesse wrote: my editor forces a hard line break at column position 16384, which, of course, corrupts the restore. I don't know if there are other text editors that will not do this, Funny, i've never seen one that does? What system/editor are you using? or even better, if there is a way to add a hard line break after each inserted record. I realize this will increase the size of the backup file, but to me, it's worth it. try to use the --max_allowed_packet= option - afaik mysqldump will create lines as long as max_allowed_packet so if you set this to 8k you should get nice short lines Any ideas? Thanks, Jesse -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Backup questions
Jesse wrote: Funny, i've never seen one that does? What system/editor are you using? Multi-Edit version 8.0i. This is an older version of the editor. Maybe a newer one wouldn't, but for the most part, it does a very good job for me. Ok never heard of multiedit... if your system is windows, try to use EditPlus. Under any *nix variant, ofcourse just use vim. try to use the --max_allowed_packet= option - afaik mysqldump will create lines as long as max_allowed_packet so if you set this to 8k you should get nice short lines This didn't seem to make any difference in the length of the line. Even if it did, I have a feeling it would go to the 8K column, and just chop it right there, the same way it is at the 16384th column. in that case you need to throw that editor as far as way as you can and never ever use it again ;) Thanks, Jesse -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Full Text Search across 2 tables.
Maybe something like this: select ft.topic, fm.message from forums_topics ft, forums_messages fm match (ft.topic, fm.message) against (...) if topic is null then the hit is from fm and vice versa... haven't tried it, so might not work :) Steffan A. Cline wrote: I have 2 tables which have full text index on each of their columns. Table 1 - forums_topics field - topic Table 2 - forums_messages field - message Is it possible to search them both in one query and determine which table the result is being returned from in the search results? Thanks Steffan --- T E L 6 0 2 . 5 7 9 . 4 2 3 0 | F A X 6 0 2 . 9 7 1 . 1 6 9 4 Steffan A. Cline [EMAIL PROTECTED] Phoenix, Az http://www.ExecuChoice.net USA AIM : SteffanC ICQ : 57234309 Lasso Partner Alliance Member --- -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: is there a way to optimize like '%..%' searches ?
It's basically a log that people needs to be able to search with wildcards in... the log grows many thousand records per day and never gets smaller, so searches just gets slower and slower. There is a sort field, the timestamp which is used in the searches, but it only makes the searches lsower yet instead of helping in the query, since all that does is sort by timestamp desc basically the query works like this: some searches for foo bar baz and i create an sql that looks like: select * from table where logline like '%foo%bar%baz%' order by timestamp desc. I have wrekced my brian plenty but have not come up with any otehr way of doing it that gives the needed flexibility in the searces. Since what is searched for is not words as such - most loglines are actually a single word on the form somethingspecialcharsomethingspecialcharsomethingspecialcharsomethingspecialcharsomethingspecialchar and so on - the logline is varibale length and variable number of entities between the sepcial chars (even the special chars are very varied) and of no specific format, thus the needed flexibility in the searches. If i coud i would changes the log format, but that is not possible since this database has loglines going all the way back to the 1980's (with more old lines being added as well as new ones) and the format has changed many times since then... Basically i am stuck with a very crappy heap of data i need to be able to search in a smart manner. Fulltext seaching would have been ideal if i was able to do boolean macthes with leading wildcard, but without it is useless :/ btw the result doesn't need scoring for relevance at all - what is searched for is always the newest matches to the searchterm, regardless of relevance (relevance could become handy at a later stage tho, but i dare not even think about it atm) Dan Buettner wrote: Bummer, Martin. What more can you tell us about your specific application? What are you storing and searching on, exactly? Any chance you can filter on another column to reduce the number of records that need a string search? Dan On 6/28/06, Martin Jespersen [EMAIL PROTECTED] wrote: I was too fast there it seems fulltext searches doesn't help after all since i can't use leading wildcards to words :( too bad i loved the speed :/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
is there a way to optimize like '%..%' searches ?
Hey all i am running mysql 4.1.20. I have a table with about 2.5 million records and i have to do queries on it that looks something like: select * from table where field1 like '%some%thing%' order by field2 This is ofcourse very slow since it refuses to use indexes... i have fairly large read_rnd_buffer (32M) and sort_buffer (32M) but this query is still slow as hell... Any hints as to how i can optimize the query? or tune my server settings to produce faster results? Regards Martin Jespersen -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: is there a way to optimize like '%..%' searches ?
Indeed fulltext searches was the cure i was looking for. Queries went from over 116 seconds to less than half a second thx for the tip ;) Dan Buettner wrote: Martin, currently there is not a way to optimize that particular type of query. You might consider changing to fulltext indexes and searches instead, as it could be faster, but it is a slightly different animal from LIKE so may not fit your needs. http://dev.mysql.com/doc/refman/4.1/en/fulltext-search.html If there is any way you can limit the search set using another column that could be indexed, it could speed things up significantly. Date, type of document, author, etc. Even if it were an optional criteria for people it might speed up at least some of the searches. Dan On 6/28/06, Martin Jespersen [EMAIL PROTECTED] wrote: Hey all i am running mysql 4.1.20. I have a table with about 2.5 million records and i have to do queries on it that looks something like: select * from table where field1 like '%some%thing%' order by field2 This is ofcourse very slow since it refuses to use indexes... i have fairly large read_rnd_buffer (32M) and sort_buffer (32M) but this query is still slow as hell... Any hints as to how i can optimize the query? or tune my server settings to produce faster results? Regards Martin Jespersen -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: is there a way to optimize like '%..%' searches ?
I was too fast there it seems fulltext searches doesn't help after all since i can't use leading wildcards to words :( too bad i loved the speed :/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
assembler not found or what?
Hi all i am compiling mysql 4.1.20 with he following options: export CFLAGS=-O3 -fomit-frame-pointer -march=nocona -msse3 export CXXFLAGS=-O3 -fomit-frame-pointer -felide-constructors -march=nocona -msse3 ./configure --prefix=/opt/.mysql-4.1.20 --enable-assembler --with-mysqld-ldflags=-all-static --enable-thread-safe-client --with-gnu-ld --with-mysqld-user=mysql --without-debug --with-charset=latin1 --with-collation=latin1_danish_ci --without-innodb --with-lib-ccflags=-O3 -fomit-frame-pointer -march=nocona -msse3 When configure runs it tells me that it isn't going to use assembler functions, even tho /usr/bin/as is in the path. anyone have any idea why? Regards Martin Jespersen -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Just need script for creating tables
--no-data should do the trick, try to do mysqldump --help and read the output Xiaobo Chen wrote: Hi, all If I use 'mysqldump', I will get the script to create the tables and those 'insert' statements to insert the data. I am wondering if I just want the first part, i.e, the script to create the table, is there a command for this end? (I could copy paste the part from 'mysqldump' but it's not what I want to do.) Cheers. Xiaobo -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Problems when compiling the source
Hello all. I have an odd problem i hope you can help me with. I've been compiling mysql from source for the past 10 years or so and just recently thought it mighjt be tiome to upgrade from the 3.23.58 i have, to a newer version. I chose mysql 4.1.20 and went on to compile it. A little info about my system: My system is Linux kernel 2.6.16.20-1trsmp (Trustix Secure Linux 3.0) running on a P4 3GhZ (with 64bit extentions)with 1GB ram. My gcc is: Configured with: ../configure --prefix=/usr --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --disable-libunwind-exceptions --with-system-zlib --enable-__cxa_atexit --enable-languages=c,c++ --disable-libgcj --host=i586-trustix-linux Thread model: posix gcc version 3.4.4 (Trustix) My ld is: GNU ld version 2.15 My configure options: export CC=gcc export CFLAGS=-O3 -fomit-frame-pointer -march=nocona -msse3 export CXX=gcc export CXXFLAGS=-O3 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti -march=nocona -msse3 ./configure --prefix=/opt/.mysql-4.1.20 --enable-assembler --enable-thread-safe-client --enable-static=all --with-gnu-ld --with-mysqld-user=mysql --without-debug --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-charset=latin1 --with-collation=latin1_danish_ci --without-innodb --with-lib-ccflags=-O3 -fomit-frame-pointer -march=nocona -msse3 --with-comment I get the same results if i configure without --with-lib-ccflags=-O3 -fomit-frame-pointer -march=nocona -msse3 --with-comment i do make and make install and nothing fails. I get a few warnings of the type: ../mysys/libmysys.a(my_tempnam.o)(.text+0x38): In function `my_tempnam': : warning: the use of `tempnam' is dangerous, better use `mkstemp' ../mysys/libmysys.a(mf_pack.o)(.text+0x4ef): In function `unpack_dirname': : warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking ../mysys/libmysys.a(mf_pack.o)(.text+0x4f8): In function `unpack_dirname': : warning: Using 'endpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /bin/sh ../libtool --preserve-dup-deps --tag=CC --mode=link gcc -DDBUG_OFF -O3 -fomit-frame-pointer -march=nocona -msse3-rdynamic -o perror perror.o -all-static ../mysys/libmysys.a ../dbug/libdbug.a ../strings/libmystrings.a -lpthread -lcrypt -lnsl -lm -lpthread ../mysys/libmysys.a(mf_pack.o)(.text+0x4ef): In function `unpack_dirname': : warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking ../mysys/libmysys.a(mf_pack.o)(.text+0x4f8): In function `unpack_dirname': : warning: Using 'endpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking but nothing fatal. now after i have done make install i do ln -s /opt/.mysql-4.1.20 /opt/mysql /opt/mysql/bin/mysql_install_db --user=mysql cd /opt/mysql chown -R root * chown -R mysql var chgrp -R mysql * And now the problems start. The server runs fine, but the client doesn't work _at all_: (root)/opt/.mysql-4.1.20/bin: ./mysql bash: ./mysql: No such file or directory (root)/opt/.mysql-4.1.20/bin: ./mysqladmin bash: ./mysqladmin: No such file or directory (root)/opt/.mysql-4.1.20/bin: ls comp_err* mysql_client_test* mysql_setpermission* mysqld_multi*mysqltest* isamchk*mysql_config*mysql_tableinfo* mysqld_safe* pack_isam* isamlog*mysql_convert_table_format* mysql_tzinfo_to_sql* mysqldump* perror* msql2mysql* mysql_create_system_tables* mysql_waitpid* mysqldumpslow* replace* my_print_defaults* mysql_explain_log* mysql_zap* mysqlhotcopy*resolve_stack_dump* myisam_ftdump* mysql_find_rows* mysqlaccess* mysqlimport* resolveip* myisamchk* mysql_fix_extensions*mysqladmin* mysqlmanager* myisamlog* mysql_fix_privilege_tables* mysqlbinlog* mysqlmanager-pwgen* myisampack* mysql_install_db*mysqlbug* mysqlmanagerc* mysql* mysql_secure_installation* mysqlcheck* mysqlshow* Now The files are there, but bash tells me they aren't? or is it the programs sending No such file or directory back to bash? I am clueless as to what is going on... Any hints would be appreciated. Also, the manual hasn't updated anything about compiler options since the gcc 2.95.2 days... maybe it was about time to get some updated info about the mysql crews favorite compiletime options. regards Martin Jespersen -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Problems when compiling the source
I thought of that, but i didn't think it'd be a problem since i do have thpse shared libraries for the application to use at runtime - and since the server runs just fine, i doubt that is what is causing the problem (tho it is definately worth trying). It seems to me that if this is truely the problem, then neither the server nor the client should be able to run. Since it is only the client that won't work (and i am still baffled by the error message when i try to run the client), i am lead to believe there is something else in play. Chris White wrote: On Tuesday 20 June 2006 12:02 pm, Martin Jespersen wrote: ./configure --prefix=/opt/.mysql-4.1.20 --enable-assembler --enable-thread-safe-client --enable-static=all --with-gnu-ld --with-mysqld-user=mysql --without-debug --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-charset=latin1 --with-collation=latin1_danish_ci --without-innodb --with-lib-ccflags=-O3 -fomit-frame-pointer -march=nocona -msse3 --with-comment Try killing the --enable-static=all and --with-mysqld-ldflags part. Looks like the code doesn't like it because of certain glibc functions: ../mysys/libmysys.a(mf_pack.o)(.text+0x4ef): In function `unpack_dirname': : warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]