Archive for the ‘mysql’ Category
Wednesday, March 28th, 2007
MySQL won't let you delete from a table using a subquery that references itself. Fair enough. To get around this, up till now, I've used temporary tables. However, I've never really liked it, and I've always wanted a JOIN delete. Well, apparently it exists.
I'm cleaning ...
Posted in mysql | 1 Comment »
Friday, March 9th, 2007
Using mysql -e's feature, combined with awk and xargs, I was able to call an existing stored procedure repeatedly for a resultset. Yes, I could have written another stored procedure to do this, I realize. But I guess I like doing things the hard way. Either that, ...
Posted in linux, mysql | No Comments »
Tuesday, February 13th, 2007
Every now and then, we find that we will have a sudden increase in the number of apache processes, load average will spike up, and then go back down to normal. In rare cases, we will see the same thing happen, and the load avg spike WAY up, all ...
Posted in apache, linux, mysql, php | 2 Comments »
Thursday, February 8th, 2007
As of MySQL 5.0 there is no SHOW CREATE TRIGGER which is pretty annoying. I don't like using "show triggers like ", so I figured I'd write a wrapper around mysqldump. For the record, this was a huge pain the ass. I did this on Fedora, GNU ...
Posted in mysql | 4 Comments »
Tuesday, January 23rd, 2007
Our sysadmin has a nice blog post with a few tips for using mysqldump, especially if your database is used for more than a basic site, or if you have stored procedures and/or triggers.
Posted in mysql | No Comments »
Friday, January 19th, 2007
A while ago when I started my first job in LA, I was using MSSQL. I was told to never use count(*), and rather to use count(1). Several people insisted this performs better than count(*), and since I really didn't care to argue or look into it, I ...
Posted in misconception, mysql | 4 Comments »
Wednesday, January 17th, 2007
REPLACE INTO will actually perform a delete and then an insert, while INSERT ... ON DUPLCIATE KEY UPDATE will perform an update (as the name suggests). I would think the latter would be faster. I have not done any performance testing between the two, but it only seems ...
Posted in mysql | 4 Comments »
Saturday, November 11th, 2006
For a long time, whenever I wanted to do paging to browse through a table, I used to run 2 queries. The first would get the results, and the second would be an almost identical query, with a count() instead of fields, and I'd use the result of the ...
Posted in mysql | 2 Comments »
Wednesday, September 27th, 2006
I do not think you can use the result of a stored procedure in an ad-hoc subquery.
On my social network, LetsGetNuts.com, I have a Friend table. This is the structure:
mysql> describe Friend;
+----------------+---------------+------+-----+---------+-------+
| Field | Type ...
Posted in letsgetnuts.com, mysql | 12 Comments »
Wednesday, September 20th, 2006
Maybe not breaking news, but I think it's interesting enough of a point, and I didn't really find anything about the topic when I googled it. If you do any addition, subtraction, multiplication, or division (and probably a lot more mathematical functions for that matter) and NULL is one of ...
Posted in mysql, tips | 14 Comments »