Wednesday, 20 February 2013

Websiting

This morning I was doing some website work. I had a couple of SQL queries to clean up unused values from tables. But the queries were very slow.

Looking into this, I found recommendations to use JOINs as using IN and subqueries is very slow. (I was using NOT IN with a subquery). MYSQL Delete w/ Join and MySQL Forums :: Optimizer & Parser :: 'not in' query is very slow how to change it?. Sure enough, when I changed my queries to use joins, they were immensely faster.

Doing var_dump on an array while doing some debugging, I noticed that the integer values pulled from the database were strings. This doesn't really matter for my purposes, but I thought it would be better if the types were retained from the database. Doing a quick search, it seems that it just doesn't work this way with MySQL though: MySQL integer field is returned as string in PHP. I wonder why the driver has not been written to keep types?

Most of the rest of the day I was just doing website work. I actually (kind of) got some work done today. Though it's just re-writing existing functionality, so you could say I didn't get anything new done.

No comments: