Assume I have a table with 40 columns.  I would like to know the
difference between

 

Select * from table

Select column1, column2, column3 from table

 

While doing SQLITE3_PREPARE, will both take same amount of time? 

While doing SQLITE3_STEP, will both take same amount of time?

------------------------------------------------------------------------
-------------------

sqlite3_prepare("Select * from table");

while(1)

{

iRet = sqlite3_step(pStmt);

if(iRet != SQLITE_ROW)

{

            iRet = sqlite3_finalize(pStmt);

            break;

}

Sqlite3_column_int(pStmt, column1);

Sqlite3_column_int(pStmt, column2);

Sqlite3_column_int(pStmt, column3);

}

------------------------------------------------------------------------
-------------------

sqlite3_prepare("Select column1, column2, column3 from table");

while(1)

{

iRet = sqlite3_step(pStmt);

if(iRet != SQLITE_ROW)

{

            iRet = sqlite3_finalize(pStmt);

            break;

}

Sqlite3_column_int(pStmt, column1);

Sqlite3_column_int(pStmt, column2);

Sqlite3_column_int(pStmt, column3);

}

------------------------------------------------------------------------
-------------------

 

If I want to extract just the 3 columns (column1, column2, column3), and
use select* from table as sql query, how much impact it will have?

 

Why I want to do this is because in some cases I need some particular
combination in another any other combination of columns to be extracted?
(It's possible for me to do this using "select * from table" but it's
not possible if I used "select column1, column2, column3 from table" as
I will have to frame another query)

 

NOTE: Please don't look at the syntax of sqlite3_prepare I just wrote
the code to show what I want to do.

 

Regards,

Phani

Reply via email to