Re: Yet again on indices...

From: Thomas Swan <tswan-lst(at)ics(dot)olemiss(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jean-Paul ARGUDO <jean-paul(dot)argudo(at)idealx(dot)com>, pgsql-hackers(at)postgresql(dot)org, sdinot(at)idealx(dot)com, dbarth(at)idealx(dot)com
Subject: Re: Yet again on indices...
Date: 2002-02-27 18:37:32
Message-ID: 3C7D276C.304@ics.olemiss.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
Tom Lane wrote:<br>
<blockquote type="cite" cite="mid22262(dot)1014823120(at)sss(dot)pgh(dot)pa(dot)us">
<pre wrap="">Jean-Paul ARGUDO <a class="moz-txt-link-rfc2396E" href="mailto:jean-paul(dot)argudo(at)idealx(dot)com">&lt;jean-paul(dot)argudo(at)idealx(dot)com&gt;</a> writes:<br></pre>
<blockquote type="cite">
<pre wrap="">EXPLAIN SELECT t12_bskid, t12_pnb, t12_lne, t12_tck<br>FROM T12_20011231<br>WHERE t12_bskid &gt;= 1 <br>ORDER BY t12_bskid, t12_pnb, t12_tck, t12_lne;<br></pre>
</blockquote>
<pre wrap=""><!----><br></pre>
<blockquote type="cite">
<pre wrap="">Sort (cost=3006.13..3006.13 rows=25693 width=46)<br> -&gt; Seq Scan on t12_20011231 (cost=0.00..1124.20 rows=25693 width=46)<br></pre>
</blockquote>
<pre wrap=""><!----></pre>
</blockquote>
Try the following:<br>
<br>
EXPLAIN ANALYZE SELECT t12_bskid, t12_pnb, t12_lne, t12_tck FROM T12_20011231
WHERE t12_bskid &gt;= 1 &nbsp;ORDER BY t12_bskid, t12_pnb, t12_tck, t12_lne;<br>

<pre wrap=""><!----></pre>
and see what the actual results are. &nbsp;Then turn the seq_scans off and do
the same thing.<br>
<blockquote type="cite" cite="mid22262(dot)1014823120(at)sss(dot)pgh(dot)pa(dot)us">
<pre wrap=""><br></pre>
<blockquote type="cite">
<pre wrap="">=&gt; Uh? Seq scan cheaper than index??? <br></pre>
</blockquote>
<pre wrap=""><!----><br>For that kind of query, very probably. How much of the table is<br>actually selected by "WHERE t12_bskid &gt;= 1"?<br><br> regards, tom lane<br><br>---------------------------(end of broadcast)---------------------------<br>TIP 2: you can get off all lists at once with the unregister command<br> (send "unregister YourEmailAddressHere" to <a class="moz-txt-link-abbreviated" href="mailto:majordomo(at)postgresql(dot)org">majordomo(at)postgresql(dot)org</a>)<br></pre>
</blockquote>
<br>
<br>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 1.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-02-27 19:06:37 Re: Refactoring of command.c
Previous Message Oleg Bartunov 2002-02-27 18:29:31 Re: single task postgresql