This is my first problem reported in stackoverflow.
In my MySQL database there is a procedure like this:
CREATE DEFINER=`root`@`localhost` PROCEDURE `getGeodataCoords`(IN `inDataset` INT, IN `inLat` FLOAT, IN `inLon` FLOAT)
NO SQL
SELECT lat, lon, SQRT(POW(ABS(inLat - lat), 2) + POW(ABS(inLon - lon), 2)) as distance FROM geodata WHERE dataset = inDataset ORDER BY distance ASC LIMIT 1
I have a table with coordinates and related values. Every time user clicks on map the closest point from table is selected and value is returned.
When I use this procedure through phpMyAdmin everything works fine but calling it in CodeIgniter's controller causes performance problems.
After first call the error like this appeared (before first call there isn't any problem):
A Database Error Occurred
Unable to select the specified database: mgr2
Filename: core/Loader.php
Line Number: 346
And now the error appears occasionally (50% chance to appear, even if I call method not related with problematic procedure) until MySQL database is restarted.
Currently in geodata table there are about 2k records. I was trying to increase memory confs for MySQL but without any result. What can be wrong?
Regards, Maciej Nowak