Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a PostGIS dataset with around 3 million shapes. I only need to view about 1,500 of these shapes at any given time, but the shapes I need to see depends on which feature is selected in a different dataset.

My question is: what is the speed difference between filtering my large dataset within PostGIS and then serving it up to QGIS, vs loading the entire dataset into QGIS and then using the baked-in layer filtering? I'm running PostGIS 2 and QGIS 1.8.

I assume PostGIS is faster, but how much faster? I'd like a second opinion before I spend my time coding for one solution over the other. Thanks!

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

Filtering (ie. using Layer / Query or the Query Builder in layer properties) in QGIS justs adds a where clause to the query that is executed. So that shouldn't be different to you want to do "in" PostGIS. Although I'm not sure what you intent to do there.

share|improve this answer
    
So, does that mean that the layer filter in QGIS is actually filtering at the database level, or is there something happening under the hood in the program? I had assumed there was a difference. –  spencerrecneps Jun 23 '12 at 23:44
1  
Yes, on database level. Although there are a few places where you might expect that QGIS also filters on database level, but doesn't (eg. when searching in the attribute table). But that happens after the "query filter" is already applied on database level. –  jef Jun 24 '12 at 0:00
    
Good to know. Thanks! –  spencerrecneps Jun 24 '12 at 0:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.