Re: Seq scan of table?

From: "Bjorn T Johansen" <btj(at)havleik(dot)no>
To: pgsql-general(at)postgresql(dot)org
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Seq scan of table?
Date: 2003-09-05 08:47:54
Message-ID: 31414.193.212.14.12.1062751674.squirrel@www.havleik.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-performance

I think I have found out why.. I have a where clause on a ID field but it
seems like I need to cast this integer to the same integer as the field is
defined in the table, else it will do a tablescan.

Is this assumtion correct? And if it is, do I then need to change all my
sql's to cast the where clause where I just have a number (eg where field
= 1) to force the planner to use index scan instead of seq scan?

BTJ

> I am trying to tune my database and I discovered one select that does a
> seq scan on a table but I can't see why... All the join fields are indexed
> and I am returning just one record, so no sort is done.
> Does it just pick seq scan for the heck of it or is it a reason?
>
> Regards,
>
> BTJ
>
> -----------------------------------------------------------------------------------------------
> Bjørn T Johansen (BSc,MNIF)
> Executive Manager
> btj(at)havleik(dot)no Havleik Consulting
> Phone : +47 67 54 15 17 Conradisvei 4
> Fax : +47 67 54 13 91 N-1338 Sandvika
> Cellular : +47 926 93 298 http://www.havleik.no
> -----------------------------------------------------------------------------------------------
> "The stickers on the side of the box said "Supported Platforms: Windows
> 98, Windows NT 4.0,
> Windows 2000 or better", so clearly Linux was a supported platform."
> -----------------------------------------------------------------------------------------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2003-09-05 08:49:51 Re: [HACKERS] Question about Scripting in Postgresql.
Previous Message Csaba Nagy 2003-09-05 08:44:04 Re: Replaceing records

Browse pgsql-performance by date

  From Date Subject
Next Message Richard Huxton 2003-09-05 10:07:12 Re: [PERFORM] Seq scan of table?
Previous Message Richard Huxton 2003-09-05 08:34:52 Re: Performance problems on a fairly big table with two key columns.