Feature request #364

'better' SQL to return results faster from the sample button in the query builder

Added by rhys-stewart-gmail-com - over 17 years ago. Updated over 14 years ago.

Status:Closed
Priority:Low
Assignee:Gary Sherman
Category:Data Provider
Pull Request or Patch supplied: Resolution:fixed
Easy fix?:No Copied to github as #:10423

Description

Currently the sql that is used to return a subset of the values of a given column is:

SELECT DISTINCT mycolumn FROM mytable ORDER BY mycolumn LIMIT 25

this will be very slow on very large tables. On a table with ~670000 records this took about 15 seconds execute. A faster method would be a subselect as follows:

SELECT DISTINCT mycol from (SELECT mycol FROM mytable LIMIT 5000) as myfoo

This query took much less than a second to execute on the same table.

QgsPgQueryBuilder::on_btnSampleValues_clicked()

qgspgquerybuilder.cpp.diff Magnifier (368 Bytes) rhys-stewart-gmail-com -, 2006-10-29 12:27 PM

History

#1 Updated by Gavin Macaulay - over 17 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

Applied in svn

Thanks for the improvement.

#2 Updated by Anonymous over 14 years ago

Milestone Version 0.8 deleted

Also available in: Atom PDF