I'm new to CartoDB and so far impressed. But I'm struggling with how to get a sql query to persist in a visualization. I type it in, like 'SELECT * FROM env_feedlots where active = 'Y' and BIRDS > 0', hit "Apply", and see the effects in the map. But I get a throbber in my browser tab that never seems to die.

And then, when returning to the visualization, it seems the sql query is gone.

Here's a link to my viz: http://cdb.io/1ncUdG7

When you load it up, if you see my sql query, you'll see clusters of dark blue in the central and southeast portions of the state, and very light blues in the southwest. It seems like that works through the "public map" link. But why doesn't it "keep" when I return to the visualization through my dashboard?

Edit: I found a "fix", if I click "clear this sql view", I can start over, re-type the SQL I want, click "Apply", and it will persist. But that begs the question: why can't I ADD to an existing SQL query and have that addition persist?

  • Try hitting the undo button. Does your previous SQL statement come up?
    – Dave
    Oct 9, 2014 at 18:09
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. Oct 9, 2014 at 18:30

1 Answer 1


When you apply an SELECT SQL query from the CartoDB editor, a green bar appears as a header with two options: create table from query and clear view. Moreover, your table view gets updated with the contents that fulfill the applied SQL query.

However, when you expand this query by adding some additional filtering parameter (or replace the applied query with an UPDATE statement) and hit the Apply button, the new query may have not effect. The reason behind this is that when you perform a SQL query, your table gets updated with the contents that match such query (you may think of this as a filtered version of your table).

Therefore, you need to clear your SQL query each time you want to perform new queries on your original table (or on data that do not appear on your filtered table).

  • Thanks, that makes sense. It just wasn't immediately obvious to me at the time, because I could apply it at first and see the results, but then they wouldn't stay.
    – Mike D
    Oct 14, 2014 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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