On Wednesday, 20 August, 2014, at 02:40, dd <durga.d...@gmail.com> asked:

>  Executing like query in a transaction. Query works with multiple tables
>and table has 1 million records on desktop clients. CPU goes high when
>transaction in progress.

>   Is there any way to control the CPU without adding sleep statements?

As suggested, the only way to artificially impose limits on execution is 
through the OS dispatcher thread priority mechanisms.  Execution will proceed 
at the maximum rate permitted by the first fully consumed resource.  This 
resource may be CPU, I/O, memory bandwidth, video bandwidth, etc.  In your case 
it would appear that the limit is set by CPU resources.  By lowering the thread 
priority of the executing thread you can request that the OS prioritize CPU 
allocation to other competing threads.

This will not reduce CPU usage -- it will only allow you to make this 
particular task have less priority than competing threads.  Total CPU usage 
will remain at 100%.

>   Is there any alternative solution for like queries? (for ex: delete *
>from emp where empname like "%a")

Alternative solution for what?  Looking through a table for all rows where the 
last character of a column is an 'a' character requires visiting every row in 
turn and testing the value of the last character and there is nothing you can 
do about this fact.  

You could, for example, avoid the full table scan by adding a field to the 
table called emanpme and put in it the reversed value of the empname field when 
you populate the table (and on every update of the empname field), and create 
an index on that column.  You would then rephrase you query as "delete * from 
emp where emanpme like 'a%';" which would limit the visitation via a partial 
index scan.  This is, however, a solution that you implement at design time.




_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to