P. 1
Optimizing Performance for the ADOBE FLASH PLATFORM

Optimizing Performance for the ADOBE FLASH PLATFORM

|Views: 547|Likes:
Published by Natasya Hopkins

More info:

Published by: Natasya Hopkins on May 09, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/09/2011

pdf

text

original

Use a fully qualified table name (including database name) in your SQL statement.

Always explicitly specify the database name along with each table name in a statement. (Use “main” if it’s the main
database). For example, the following code includes an explicit database name main:

SELECT employeeId

FROM main.employees

Explicitly specifying the database name prevents the runtime from having to check each connected database to find
the matching table. It also prevents the possibility of having the runtime choose the wrong database. Follow this rule
even if a SQLConnection is only connected to a single database. Behind the scenes, the SQLConnection is also
connected to a temporary database that is accessible through SQL statements.

Use explicit column names in SQL INSERT and SELECT statements.

The following examples show the use of explicit column names:

INSERT INTO main.employees (firstName, lastName, salary)

VALUES ("Bob", "Jones", 2000)

SELECT employeeId, lastName, firstName, salary

FROM main.employees

Compare the preceding examples to the following ones. Avoid this style of code:

85

OPTIMIZING PERFORMANCE FOR THE FLASH PLATFORM

SQL database performance

Last updated 6/23/2010

-- bad because column names aren't specified

INSERT INTO main.employees

VALUES ("Bob", "Jones", 2000)

-- bad because it uses a wildcard

SELECT *

FROM main.employees

Without explicit column names, the runtime has to do extra work to figure out the column names. If a SELECT
statement uses a wildcard rather than explicit columns, it causes the runtime to retrieve extra data. This extra data
requires extra processing and creates extra object instances that aren’t needed.

Avoid joining the same table multiple times in a statement, unless you are comparing the table to itself.

As SQL statements grow large, you can unintentionally join a database table to the query multiple times. Often, the
same result could be achieved by using the table only once. Joining the same table multiple times is likely to happen if
you are using one or more views in a query. For example, you could be joining a table to the query, and also a view that
includes the data from that table. The two operations would cause more than one join.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->