DB connection times

Bob Sneidar bobsneidar at iotecdigital.com
Mon Mar 2 12:25:40 EST 2015


To optimize connections and transfer of data, one of the things you can do is use VarChar() instead of TEXT whenever possible. A very knowledgable web designer explained to me that TEXT types pad the storage values to fill the defined storage size for that column, whereas VarChar only stores as much data as is in the column for that record. 

Another thing you can do is avoid querying for BLOB types until you actually need the data. Thirdly, I suspect as others have said, that using transactional querying, and combining all your SQL statements into one using the semi-colon delimiter is probably going to save some time overall. 

I have a habit of querying the entire record so that I do not have to refactor my code every time I add or remove a column in my tables. But I am willing to live with the performance hit, at least for now, and make sure I only query the data I happen to need at the moment. 

Bob S


> On Mar 1, 2015, at 09:27 , Richard Gaskin <ambassador at fourthworld.com> wrote:
> 
> Dr. Hawkins and others have noted that the time required for LC to connect to a database can be long enough to add up under load.
> 
> To get a good feel for the implications of this, and to explore options for possibly mitigating it, it would be helpful if any of you happen to have measurements of that connection time.
> 
> On the one hand, for LC to connect to a DB does require quite a few steps: your code is interpreted, passed from the engine to the external, the external reformats it into a form the DB will understand, then the DB works with it and sends back a value, which then is reformatted by the external and sent back to the engine, which then delivers it to your script.
> 
> But on the other hand, each of those steps should be pretty small, and most of them are taking place in compiled object code.
> 
> I may take the time in the future to set up some tests to measure connection times myself, but before I do it seems useful to see if any of you already have such measurements.
> 
> If you do, I'd be very interested in hearing what sorts of times you find not only for connections, but queries as well.
> 
> TIA -
> 
> -- 
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web
> ____________________________________________________________________
> Ambassador at FourthWorld.com                http://www.FourthWorld.com
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list