Re: Explain plan on a Select query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi John,

How many rows are in the table?  If the table is small with respect to row count, and the pages are not very fragmented, ie, not many pages, then PG is just doing the right thing here: seq scan is less expensive than index scan in those cases.  You can turn off enable_seqscan to just make sure it does use the index.

Regards,
Michael Vitale

John Scalia wrote on 3/16/2020 12:26 PM:
I’m a bit confused on an explain plan I just generated for a select statement. The plan’s first line begins with the word “Append” followed by the usual (cost....) data. What in the world is an Append doing here? I’ve recently performed  another analyze on the table, btw.

Also, the query does not seem to be using an index, as the explain shows a pair of sequential scans, speaking of which, the second sequential scan shows it’s on a table, called <table>_test. Which is a little strange, considering that does not exist.

The query’s where clause is on a varchar(25) field. And that field has both a btree index and a trigram index on it. I’ve tried using where =, like, and ~ in order to see if I can get it to use an index. All attempts continue to say sequential scan.
—
Jay
Sent from my iPad







[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux