#364 closed enhancement (fixed)
'better' SQL to return results faster from the sample button in the query builder
Reported by: | Owned by: | gsherman | |
---|---|---|---|
Priority: | minor: annoyance | Milestone: | |
Component: | Data Provider | Version: | 0.8 |
Keywords: | querybuilder, qgspgquerybuilder.cpp | Cc: | |
Must Fix for Release: | No | Platform: | All |
Platform Version: | Awaiting user input: | no |
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()
Attachments (1)
Change History (3)
by , 18 years ago
Attachment: | qgspgquerybuilder.cpp.diff added |
---|
comment:1 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Applied in svn r6032
Thanks for the improvement.