gqlplus – sqlplus with readline (tab completion)

2012-08-03 1 min read Database

Tab completion is something which is missing in the sqlplus and if you have lot of tables with long names or lot of columns then it is sufficiently  difficult to type them 🙂

Here is a solution for this problem. Download and install gqlplus. gqlplus is a replcement for sqlplus which supports completion for commands/tablenames and column names. Quite useful.

Oracle SQL*Plus
Oracle SQL*Plus (Photo credit: Manuel Cernuda)
Enhanced by Zemanta

Oracle Select the top 5 queries

2012-02-27 1 min read Database

Here are one sql script that I found some time back. This will be listing the top 5 SQL queries in Oracle.

SET linesize 300
SET PAGESIZE 200
select *
from
(select sql_text,
        sql_id,
        elapsed_time,
        cpu_time,
        user_io_wait_time
from    sys.v_$sqlarea
order by 5 desc)
where rownum < 6;
quit;
Enhanced by Zemanta

Benchmarking the system/CPU performance

2012-01-15 2 min read Bash Fedora Learning

Have you ever wanted to have a quick check on your CPU performance. I know that lot of people will say that this is not the right way to do this, but here is something that you can use to check the CPU speed.

#!/bin/bash -
#===============================================================================
#
#          FILE:  benchmark.sh
#
#         USAGE:  ./benchmark.sh
#
#   DESCRIPTION:  Benchmark the CPU
#
#       OPTIONS:  ---
#  REQUIREMENTS:  ---
#          BUGS:  ---
#         NOTES:  ---
#        AUTHOR: Amit Agarwal (aka), amit.agarwal@roamware.com
#       COMPANY: Roamware India Pvt Ltd
#       CREATED: 09/21/2011 11:46:03 AM IST
# Last modified: Wed Sep 21, 2011  12:22PM
#      REVISION:  ---
#===============================================================================

add ()
{
    COUNTER=0
    exec 2>&1
    time=$(exec 2>&1;(time while [[  $COUNTER -lt 100000 ]]; do ((COUNTER++)) \
        ; done))
    echo "Time for 100000 additions is "$time
}	# ----------  end of function add  ----------
mul ()
{
    COUNTER=0
    test=2
    exec 2>&1
    time=$(exec 2>&1;(time while [[  $COUNTER -lt 100000 ]]; do ((COUNTER++)) \
        ; ((test=test*2));done))
    echo "Time for 100000 mul is "$time
}	# ----------  end of function add  ----------
div ()
{
    COUNTER=0
    test=1000000000000
    exec 2>&1
    time=$(exec 2>&1;(time while [[  $COUNTER -lt 100000 ]]; do ((COUNTER++)) \
        ; (( test=test/2)); done)|tr -d '\n')
    echo "Time for 100000 divisions is "${time}
}	# ----------  end of function add  ----------

time add
time mul
time div

And here is the output :

Continue reading

analyze debug queries output for wordpress

2011-02-09 2 min read Wordpress

Some time back, my website became too slow and I started getting timeout response for quite a lot of my pages. When I analyzed things, I found the issue was with the DB queries taking a lot of time. So, I thought of getting my hands dirty and started with installing the plugin “Debug Queries”. Just in case, you don’t know about the plugin, it lists all the queries to DB along with the time taken for the query when a Admin user visits any page.

Continue reading

Using SQLite to maintain your monthly bills.

2010-08-24 6 min read Linux

I was looking for a small application to maintain my every month bills. The application had to be small and script-able. I basically wanted to keep track of the bills that have been generated and pending payment and the bills that have been paid.

First we will create the <a class="zem_slink" title="Database" rel="wikipedia" href="http://en.wikipedia.org/wiki/Database">database schema with the following command:

  <td>
    <div class="text codecolorer">
      CREATE TABLE bills(name varchar(20), due_dt text, p_dt text, amount integer);
    </div>
  </td>
</tr>
1

So, I built on the knowledge gathered on <a class="zem_slink" title="SQLite" rel="homepage" href="http://sqlite.org/">SQLite. And here is a small script that I wrote:

Continue reading

SQLite – simple use in scripts

2010-08-21 1 min read Database Linux

Today we will look a the most simple use&#8217;s in the scripts and how to use them.

echo &#8221;insert into bills values (&#8221;$name&#8221;,$date_now, $date_now,$1)&#8221;|sqlite bills

or the other way to do this is

<a class="zem_slink" title="SQLite" rel="homepage" href="http://sqlite.org/">sqlite3 bills &#8221;insert into bills values (&#8221;$name&#8221;,$date_now, $date_now,$1)&#8221;

OK, now in the next post we will see a simple application that I am currently developing or planning.<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://tobu.lightbird.net/">Tobu Tutorial (tobu.lightbird.net) <li class="zemanta-article-ul-li"><a href="http://go.theregister.com/feed/www.theregister.co.uk/2010/07/02/openoffice_adopts_gstreamer/">OpenOffice gets Ubuntu-media friendly (go.theregister.com) <li class="zemanta-article-ul-li"><a href="http://elegantcode.com/2010/07/02/using-transactionscope-with-sqlite/">Using TransactionScope with SQLite (elegantcode.com) <li class="zemanta-article-ul-li"><a href="http://www.slideshare.net/aikisteve/flash-and-the-city-2010">Flash And The City 2010 (slideshare.net) <div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=7b7c893c-d92b-44bc-8923-d7c6fddc8b42" alt="Enhanced by Zemanta" /><span class="zem-script more-related pretty-attribution">

Continue reading

SQLite : Manager for this simple database

2010-08-19 2 min read Database Linux

We will look at sqliteman – <a class="zem_slink" title="SQLite" rel="homepage" href="http://sqlite.org/">SQLite Database manager.

If you are looking for a tool for tuning <a class="zem_slink" title="SQL" rel="wikipedia" href="http://en.wikipedia.org/wiki/SQL">SQL statements, manage tables, views, or triggers, administrate the <a class="zem_slink" title="Database" rel="wikipedia" href="http://en.wikipedia.org/wiki/Database">database space and index <a class="zem_slink" title="Statistics" rel="wikipedia" href="http://en.wikipedia.org/wiki/Statistics">statistics then Sqliteman is the perfect choice.
If you are looking for a <a class="zem_slink" title="Graphical user interface" rel="wikipedia" href="http://en.wikipedia.org/wiki/Graphical_user_interface">graphical queries creation wizards, <a class="zem_slink" title="User interface" rel="wikipedia" href="http://en.wikipedia.org/wiki/User_interface">user interface designers for your database, or an universal report tool try the applications designed for tasks such this (<a class="zem_slink" title="Kexi" rel="homepage" href="http://kexi-project.org/">Kexi, knoda).

Continue reading
Older posts